MDrive Example Program
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 'MDRIVE DEMO PROGRAM 'Last modified 08/25/2016 'Sample test program for demonstration purposes only 'Not tested or verified for safety or any function CP 'preclear program memory '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 |