setting current and volatge for programmble power supply

5 views (last 30 days)
Oday Shahadh
Oday Shahadh on 17 Aug 2021
Hi,
I am trying to setting current and voltage on a programmle power suplly via rs232, using the code below, so I succeded to set the voltage value on the power supply while the current is still zero, pls help
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=12;
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)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by