Keithley 6514 electrometer control via RS-232

12 visualizaciones (últimos 30 días)
Bart
Bart el 27 de Jul. de 2012
Respondida: alwathiqbellah el 12 de Dic. de 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 comentario
larbi nehari
larbi nehari el 25 de Oct. de 2016
Hi man, i wonder if you actually made your code work ?! if yes please give us more details please, thank you

Iniciar sesión para comentar.

Respuestas (4)

Luca Lusuardi
Luca Lusuardi el 2 de Feb. de 2017
Editada: Walter Roberson el 2 de Feb. de 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');

Ye Sun
Ye Sun el 7 de Abr. de 2017
I have the same question. Anybody solved it yet? Thanks.

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

alwathiqbellah
alwathiqbellah el 12 de Dic. de 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.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by