delay sending data rs232

1 view (last 30 days)
Oday Shahadh
Oday Shahadh on 17 Aug 2021
hello,
Can any one help on hpe to delay the (vv) values to be delayed in sending every 2 seconds?
clc
clear all
%s = serial('COM1','BaudRate',9600,'ByteOrder','bigEndian','FlowControl','none','Terminator','','TimeOut',10);% baud
s=serial('COM7','BaudRate', 9600, 'Terminator', 'CR','ByteOrder',...
'BigEndian','InputBufferSize',256,'TimeOut',10);
fopen(s);
%get(s);
% fprintf(s,'*idn?');
% out0 = fscanf(s)
% fprintf(s,':syst:err?');
% out1 = fscanf(s)
fprintf(s,'OUTP:STAT 1');
cc=3;
cmd = num2str(cc,':CHAN1:CURR\b %2.2f;CURR?')
fprintf(s,cmd);
%out2 = fscanf(s)
vv=[2,4,6,8]; %%%%%%%%%%%%%%
vmd = num2str(vv,':CHAN1:VOLT\b %2.2f;VOLT?')
fprintf(s,vmd);
%out3 = fscanf(s)
fprintf(s,':CHAN1:MEAS:CURR?');
%out4 = fscanf(s)
fprintf(s,':CHAN1:MEAS:VOLT?');
%out5 = fscanf(s)
%fprintf(s,'OUTP:STAT 0');
fclose (s);
delete (s);

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by