Keithley 6514 electrometer control via RS-232

17 views (last 30 days)
Bart
Bart on 27 Jul 2012
Answered: alwathiqbellah on 12 Dec 2017
Hi,
I am trying to communicate with Keithley 6514 via RS-232. When I run my m-code Keithley responds, so it means there's a communication.
However voltage values, I am getting are incorrect.
I am using modified code, which I have found on internet:
s = serial('COM1');
set(s,'BaudRate',9600,'Terminator','CR','Timeout',1, 'DataBits', 8, 'Parity', 'none');
fopen(s);
fprintf(s,'*rst'); %reset instrument
fprintf(s,'*idn?'); %identify the system connected
out = fscanf(s);
if strfind(out,'KEITHLEY') %&& strfind(out,'6514') %M6514
fprintf(s,'*rst'); %reset instrument
fprintf(s,'volt:dc:rang 200'); %set voltage range
fprintf(s,'func "volt:dc";:read?'); %read voltage range
out = fscanf(s);
disp(out);
fprintf(s,':syst:loc'); %set instrument to local use
get(s);
fclose(s); %close and disconnect from com port
fclose(s);
delete(s);
clear s;
out = eval(out);
out = out*10;
out = round(out);
out = out/10;
disp(out);
else
fprintf(s,'*rst'); %reset instrument
fprintf(s,':syst:loc')
fclose(s); %close and disconnect from com port
fclose(s);
delete(s);
clear s;
msgbox('Check connections DMM!','MCS','warn');
end;
In the end I am getting three values, instead of one voltage value. I am getting -6.325239E-04,+2.887642E+03,+5.120000E+02, while real value is 8.236V.
I don't know where is the problem and how to solve it, but I get:
Error using keithley_read_1 (line 19)
Error: Unexpected MATLAB operator.
This is regarding line: out = eval(out);
Can someone help me with this?
Regards, Bart
  1 Comment
larbi nehari
larbi nehari on 25 Oct 2016
Hi man, i wonder if you actually made your code work ?! if yes please give us more details please, thank you

Sign in to comment.

Answers (4)

Luca Lusuardi
Luca Lusuardi on 2 Feb 2017
Edited: Walter Roberson on 2 Feb 2017
Actually, you have to write before voltage measurements
fprintf(s,'func "volt:dc";:read?'); %read voltage range
the following code line:
fprintf(s, 'form:elem read');
if you want read only voltage value. The standard format is [read], [time], [status]. For example, if you want time too, you have to write instead
fprintf(s, 'form:elem read, time');

Walter Roberson
Walter Roberson on 25 Oct 2016
Use sscanf(out, '%f') instead of eval(out)

Ye Sun
Ye Sun on 7 Apr 2017
I have the same question. Anybody solved it yet? Thanks.

alwathiqbellah
alwathiqbellah on 12 Dec 2017
Hi Guys
I'm wondering if anybody resolves this issue, I had the chance to communicate with Keithley 6514 via RS-232 through ExceLINX software, and I got output voltages from M6514 and ExceLINX but I need to communicate through Matlab to have the ability to synchronize with other outputs.

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!