Tektronix Technical Forums are maintained by community involvement. Feel free to post questions or respond to questions by other members. Should you require a time-sensitive answer, please contact your local Tektronix support center here.

READ? command is not working with keithley 2000 / Port RS232

Post Reply
CamLam
Posts: 1
Joined: April 29th, 2021, 8:13 am
Country: Switzerland

READ? command is not working with keithley 2000 / Port RS232

Post by CamLam » April 30th, 2021, 12:42 am

Hello everyone

I connected my keithley 2000 multimeter to my computer through a RS232 to USB cable. I would like to perform real time current measurements and store them in a matrix for the purpose of an experiment. It seems that the connection with the instrument is working because my computer is detecting the COM port and, for example, when I write the command ':DISP:ENAB OFF', the multimeter indeed stops displaying measurements on the screen.
The problem is when try to execute the command “:READ?” : nothing happens. When I run a fscanf, I get this error:
""
Warning: Unsuccessful read: A timeout occurred before the Terminator was reached.
'serial' unable to read any data. For more information on possible reasons, see Serial Read Warnings.
""

Here is part of the matlab code I use, highly inspired by the examples codes from the instrument manual:

COMData={9600,8,'none',1,'CR'};
g=serial('COM3');
set(g,{'BaudRate','DataBits','Parity','StopBits','Terminator'},COMData)

fopen(g);

fprintf(g,'*RST'); %Restore GPIB defaults
fprintf(g,'*CLS'); %clear Model 2000


fprintf(g,':INIT:CONT OFF; :ABORT'); %init off
fprintf(g,':SENS:FUNC "CURR:DC"'); %DCI
fprintf(g, ':SYST:AZER:STAT OFF'); %Auto zero off
fprintf(g, ':SENS:CURR:DC:AVER:STAT OFF'); %Filter off
fprintf(g, ':SENS:CURR:DC:NPLC 0.01'); %NPLC=0.01 number of power line cycles
fprintf(g, ':SENS:CURR:DC:RANG:AUTO 1'); %set automatic range
fprintf(g, ':SENS:CURR:DC:DIG 4'); %4 digits
fprintf(g, ':FORM:ELEM READ'); %Reading only
fprintf(g, ':TRIG:COUN 1'); %Trig count 1
fprintf(g, ':SAMP:COUN 100'); %Sample count 100
fprintf(g, ':TRIG:DEL 0'); %No trigger delay
fprintf(g, ':TRIG:SOUR IMM'); %Immediate trigger
pause(1);

fprintf(g,':READ?');
data=str2num(fscanf(g));

I am definitely not an expert, maybe this is something really stupid that I am missing... But I would be really thankful if someone could help me with this problem.
Thank you very much in advance !

Post Reply

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest