Control Newport rotational stage PM500 with Instrument Control Box

1 visualizzazione (ultimi 30 giorni)
Hello,
I am trying to control the Newport rotational stage PM500 with MatLab. The following is my program.
function t = PM500_Ang_Sec(theta)
% Create a GPIB object. theta is in arc-sec
obj = instrfind('Type', 'gpib', 'BoardIndex', 0, 'PrimaryAddress', 1, 'Tag', '');
% Create the GPIB object if it does not exist
% otherwise use the object that was found.
if isempty(obj)
obj = gpib('ni', 0, 1);
else
fclose(obj);
obj = obj(1)
end
% Connect to instrument object, obj.
fopen(obj);
angle = num2str(theta);
% Communicating with instrument object, obj.
fprintf(obj,'xy')
timedelay_ms(1000)
fprintf(obj,strcat('xg',angle))
fprintf(obj,'xr?')
timedelay_ms(500)
t1 = fscanf(obj);
t=str2num(t1(3:end));
% Disconnect from instrument object, obj.
fclose(obj);
% Clean up all objects.
delete(obj);
When I run this function (with theta = 1200, for example), I am always getting the stage to move about 10arc-sec away from the target value (1193). But when I re-run the function again, it gets to 1200. Can anyone tell me what I did wrong?
Many thanks!
Feng

Risposte (0)

Categorie

Scopri di più su Instrument Control Toolbox Supported Hardware in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by