Liberty* MCodeMDrive MCode
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 40 41 42 43 44 45 46 47 48 49 | 'LIBERTY* MDRIVE DEMO PROGRAM 'Last modified 02/21/2013 'Sample test program for demonstration purposes only 'Not tested or verified for safety or any function CP 'preclear program memory '[VARIABLES] Os = 1, 20, 1 'Velocity changing output A=2000000 D=2000000 R4=80 '[PROGRAMS] 'The main program block calls 'subroutine to calculate a slew rate 'based on the value of I5 PG 1 LB G1 R1 = I5 CL Z1 SL R3 H 10 BR G1 E 'Subroutine performs calculation 'to vary the velocity based upon 'the analog input LB Z1 R1 = R1-2032 R2 = 1 BR Z2, R1>=0 R2 = -1 R1 = R1 * R2 LB Z2 BR Z3,R1<R4 R1 = R1 * 625 R3 = R1 * R2 RT LB Z3 R3=0 RT E PG S 'Keep this line to save program on load |
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 40 41 42 43 44 45 46 47 48 49 | 'MDRIVE DEMO PROGRAM 'Last modified 02/21/2013 'Sample test program for demonstration purposes only 'Not tested or verified for safety or any function CP 'preclear program memory '[VARIABLES] S1 = 20, 1, 0 'Velocity changing output A=2000000 D=2000000 R4=80 '[PROGRAMS] 'The main program block calls 'subroutine to calculate a slew rate 'based on the value of I5 PG 1 LB G1 R1 = I5 CL Z1 SL R3 H 10 BR G1 E 'Subroutine performs calculation 'to vary the velocity based upon 'the analog input LB Z1 R1 = R1-508 R2 = 1 BR Z2, R1>=0 R2 = -1 R1 = R1 * R2 LB Z2 BR Z3,R1<R4 R1 = R1 * 2500 R3 = R1 * R2 RT LB Z3 R3=0 RT E PG S 'Keep this line to save program on load |
*Previously Lexium