'MDrive Motion Control Sample Program 'Limit Switch Test Program 'CODE DESCRIPTION S1=2,0 'set input 1 as positive limit, low true S2=3,0 'set input 2 as negative limit, low true PG 1 'enter program mode at address 1 LB aa 'label aa Vm=51200 'set max velocity to 51200 steps/sec MR 102400 'move positive 102400 steps 'close switch at input 1 to 'stop motion in the positive direction 'and cause an error 83 'NOTE: PROGRAM CONTINUES TO EXECUTE 'leave switch open and program runs normal H 'hold program execution until motion complete H 250 'hold program execution for 250 millisecond PR Er 'print error number to terminal window MR-102400 'close switch at input 2 to 'stop motion in the negative direction 'and cause an error 84 'NOTE: PROGRAM CONTINUES TO EXECUTE H 'hold program execution until motion complete H 250 'hold program execution for 250 millisecond PR Er 'print error number to terminal window BR aa 'branch to label aa E 'end program PG 'exit program mode 'hit "Esc" key to stop program