Control Newport rotational stage PM500 with Instrument Control Box

1 回表示 (過去 30 日間)
Feng
Feng 2011 年 8 月 17 日
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

回答 (0 件)

カテゴリ

Help Center および File ExchangeInstrument Control Toolbox Supported Hardware についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by