MDrive/MForce – Use of I/O sample

This program demonstrates how to configure a digital input and use the input to control program flow. There are also examples of conditional and unconditional branching. The power up label SU becomes active only after the program is saved to non-volatile memory using the S command.

'CODE           DESCRIPTION

PG 100         'Enter program mode at address 100
LB SU          'Label using SU to start program upon power up
A=1000000      'Sets acceleration to
               '1000000 steps/second square
S1=0,1         'Sets I/O 1 as a general purpose input,
               'active high
S5=9           'Sets I/O 5 as a 0-5V analog input
LB Wa         'Label Wa for setting up wait loop
BR M1,I1=1     'If input is active then branch to label M1
SL=0           'Sets slew speed to 0
BR Wa,I1=0     'If input is inactive then branch to label Wa
LB M1          'Label for motion profile 1
SL=I5*100      'Slew the axis at the rate of 0-1024 times
	       'the value of I5, the analog input.    
BR Wa          'Unconditional branch to wait loop
               'to scan input
E              'End program
PG             'Exit program mode

Download Use of I/O Sample .mxt file
(color-coded in IMS Terminal)

 

> Motion Control Code Index