Issue with making Velmex go to an specific location

31 views
Skip to first unread message

grod...@fiu.edu

unread,
Nov 12, 2018, 4:18:22 PM11/12/18
to Velmex Controls
I am working on a code to make the xy table go to an specific location. I am working with the base codes supplied and I ran into an issue where I cannot make the code work for both motors.


vmx=serial('COM3','BaudRate',9600,'DataBits',8,'Parity','None','StopBits',1);
fopen(vmx)
fprintf(vmx,'V')
out=fscanf(vmx,'%c',1)

go_right = strcat('F,C,I1M',num2str(200),',R,')

fprintf(vmx,go_right)

for i=1:10

velmexruntemp{1,i}=go_right;
fprintf(vmx,velmexruntemp{1,i})

pause(2)

fwrite(vmx,'X')

if vmxp.BytesAvailable > 0
Position = fscanf(vmx, '%e', vmx.BytesAvailable)
end

end
fclose(vmx)

%% Go to position on Motor #2

vmx=serial('COM3','BaudRate',9600,'DataBits',8,'Parity','None','StopBits',1);
fopen(vmx)
fprintf(vmx,'V')
out=fscanf(vmx,'%c',1)

go_right = strcat('F,C,I2M',num2str(200),',R,')

fprintf(vmx,go_right)

for i=1:10

velmexruntemp{1,i}=go_right;

pause(2)

fwrite(vmx,'X')

if vmx.BytesAvailable > 0
Position = fscanf(vmx, '%e', vmx.BytesAvailable)
end

end
fclose(vmx)

Reply all
Reply to author
Forward
0 new messages