Control Newport rotational stage PM500 with Instrument Control Box
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Instrument Connection and Communication에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!