Keithley 6514 electrometer control via RS-232

4 ビュー (過去 30 日間)
Bart
Bart 2012 年 7 月 27 日
回答済み: alwathiqbellah 2017 年 12 月 12 日
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 件のコメント
larbi nehari
larbi nehari 2016 年 10 月 25 日
Hi man, i wonder if you actually made your code work ?! if yes please give us more details please, thank you

サインインしてコメントする。

回答 (4 件)

Luca Lusuardi
Luca Lusuardi 2017 年 2 月 2 日
編集済み: Walter Roberson 2017 年 2 月 2 日
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');

Ye Sun
Ye Sun 2017 年 4 月 7 日
I have the same question. Anybody solved it yet? Thanks.

Walter Roberson
Walter Roberson 2016 年 10 月 25 日
Use sscanf(out, '%f') instead of eval(out)

alwathiqbellah
alwathiqbellah 2017 年 12 月 12 日
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.

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by