function rotation(start_angle, end_angle, steps, time_def) // Angles are in degrees and the time is in minutes variable start_angle, end_angle, steps, time_def variable pulse, speed pulse = 360*steps/(end_angle-start_angle) speed = PI/3*(end_angle - start_angle)/time_def if (speed<=100) VDTOperationsPort2 COM2 VDTWrite2 "M01 "+ num2str(pulse) + " " + num2str(pulse) + " " + num2str(pulse) + " " + num2str(pulse)+ num2str(pulse) + " " + num2str(pulse) + " " + num2str(pulse) + " " + num2str(pulse) +" \n" VDTWrite2 "M02 "+ num2str(speed) + " "+ num2str(speed) + " "+ num2str(speed) + " "+ num2str(speed) + num2str(speed) + " "+ num2str(speed) + " "+ num2str(speed) + " "+ num2str(speed) +" \n" VDTWrite2 "S04 "+ num2str(steps) +" "+ num2str(steps) +" "+ num2str(steps) +" "+ num2str(steps)+ num2str(steps) +" "+ num2str(steps) +" "+ num2str(steps) +" "+ num2str(steps) +" \r\n" endif  end function ConnectionExists() variable outstr VDTOperationsPort2 COM2 VDTWrite2 "S06  \r\n" VDTRead2/T="\r\n"/O=60 outstr return outstr end function EmergencyStop(emergency) variable emergency VDTOperationsPort2 COM2 VDTWrite2 "M03 "+ num2str(emergency) +" 0 0 0 0 0 0 0 " end function SmoothStop(smoothly) variable smoothly VDTOperationsPort2 COM2 VDTWrite2 "M04"+ num2str(smoothly) +" 0 0 0 0 0 0 0 " end  function ReturnZero(speed) variable speed VDTOperationsPort2 COM2 VDTWrite2 "M05 "+ num2str(speed)+" 0 0 0 0 0 0 0 " end function/S QueryAxisParam() string outstr VDTOperationsPort2 COM2 VDTWrite2 "Q02 axis \r\n" VDTRead2/T="\r\n"/O=3 outstr return outstr end function/S QueryAxisState() string outstr VDTOperationsPort2 COM2 VDTWrite2 "Q03 \r\n" print 1 VDTRead2/T="\r\n"/O=180 outstr print "Response received: ", outstr end