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 | '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 space '[VARIABLES] 'Global variable declarations Ee=1 Vm=4096 Vi=Vm/50 A=20480 D=A Hc=50 Rc=50 Mt=50 'Encoder setup Sf=20 Sm=0 Db=5 'I/O setup Is = 1, 1, 0 'Homing input Is = 2, 0, 1 'General purpose input Os = 1, 17, 1 'Moving output Os = 2, 18, 1 'Error output D1=100 '[PROGRAMS] 'Main program will home in mode 1 'Slew minus @ VM until to find 'home switch then creep plus @ VI PG 1 LB G1 H 1000 PR C1 ,C1 PR C2 ,C2 Pm=1 PR "Position counter: " C1 PR "Encoder counter: " C2 H 5000 HM 1 H P=0 'After homing, motor will 'move @ 7186 steps each move 'printing position each time LB G2 BR G2,I2=1 MR 7186 H PR "Position: " P BR G2 E PG |
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 | 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 space '[VARIABLES] 'Global variable declarations Ee=1 Vm=4096 Vi=Vm/50 A=20480 D=A Hc=50 Rc=50 Mt=50 'Encoder setup Sf=20 Sm=0 Db=5 'I/O setup Is = 1, 1, 0 'Homing input Is = 2, 0, 1 'General purpose input Os = 1, 17, 1 'Moving output Os = 2, 18, 1 'Error output D1=100 '[PROGRAMS] 'Main program will home in mode 1 'Slew minus @ VM until to find 'home switch then creep plus @ VI PG 1 LB G1 H 1000 PR C1 ,C1 PR C2 ,C2 Pm=1 PR "Position counter: " C1 PR "Encoder counter: " C2 H 5000 HM 1 H P=0 'After homing, motor will 'move @ 7186 steps each move 'printing position each time LB G2 BR G2,I2=1 MR 7186 H PR "Position: " P BR G2 E PG |