Liberty* MCodeMDrive MCode
Lexium MCode 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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | '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 '[VARIABLES] Rc=80 Mt=50 'enable encoder functions, configure stall settings Ee=1 Sf=15 Sm=0 'motion variables are scaled 'to encoder counts instead of microsteps A=20000 D=A Vi=2048 Vm=15000 'user variable created to hold move count VA Q1 '[PROGRAMS] 'program block Ga sets the on 'error handle routine to call K1 PG 1 LB Ga OE K1 P=0 'program block Gb contains the 'motion loop which will run 100 times LB Gb MR 51200 H H 500 MR -51200 H H 500 IC Q1 BR Gb,Q1<100 CL K1 E '[SUBROUTINES] 'Subroutine K1 sets the response 'for the on-error handler. It will 'perform some math to determine the 'position error in encoder counts, 'as well as display the error # if 'one occurs. LB K1 R3=C1/25 R1=R3 - C2 PR "Counts error = ",R1 PR "Error = ",Er Er=0 H 20 RT PG S 'Keep this line to save program on load '[END] |
MDrive MCode 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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | 'MDRIVE DEMO PROGRAM 'Last modified 02/21/2013 'Sample test program for demonstration purposes only 'Not tested or verified for safety or any function '[VARIABLES] Rc=80 Mt=50 'enable encoder functions, configure stall settings Ee=1 Sf=15 Sm=0 'motion variables are scaled 'to encoder counts instead of microsteps A=20000 D=A Vi=2048 Vm=15000 'user variable created to hold move count VA Q1 '[PROGRAMS] 'program block Ga sets the on 'error handle routine to call K1 PG 1 LB Ga OE K1 P=0 'program block Gb contains the 'motion loop which will run 100 times LB Gb MR 51200 H H 500 MR -51200 H H 500 IC Q1 BR Gb,Q1<100 CL K1 E '[SUBROUTINES] 'Subroutine K1 sets the response 'for the on-error handler. It will 'perform some math to determine the 'position error in encoder counts, 'as well as display the error # if 'one occurs. LB K1 R3=C1/25 R1=R3 - C2 PR "Counts error = ",R1 PR "Error = ",Er Er=0 H 20 RT PG S 'Keep this line to save program on load '[END] |
*Previously Lexium