Keithley 6514 electrometer control via RS-232
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
larbi nehari
le 25 Oct 2016
Hi man, i wonder if you actually made your code work ?! if yes please give us more details please, thank you
Réponses (4)
Luca Lusuardi
le 2 Fév 2017
Modifié(e) : Walter Roberson
le 2 Fév 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');
0 commentaires
alwathiqbellah
le 12 Déc 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.
0 commentaires
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!