Example Program

Move on Input

Description

This program will perform a point-to-point move that will trigger on the active state of an input.

The code shown on the right may be copied and pasted into the program editor window of the Motion Control Programmer application, or a zip file containing the program files may be downloaded below.

Topics

  • MCode OS

Applicable Product

  • Lexium MDrive
  • MDrive Linear Actuator
  • MDrive Plus
  • MForce

Resource Files

'This block contains the global variable 'and system configuration information. Is=1,0,0 Ms=256 Vi=200000 Vm=2500000 A=1000000 D=A Hc=2 Rc=75 P=0 '[PROGRAMS] 'The program block for this application sets 'the event that triggers the subroutine call 'when input 1 is active and loops when I1=inactive PG 1 LB Ga 'Program execution label P=0 LB G1 'Loop back label CL Kb,I1=1 H 10 BR G1 E 'Subroutine from trigger event will execute 'a ten revolution positive move, hold, the 'return to 0 in the negative direction and repeat 'as long I1=1 LB Kb 'subroutine label MA 512000 H MA 0 H RT PG 'exit program '[END] S 'keep this line
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
'LEXIUM 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]
'This block contains the global variable
'and system configuration information.
 
Is=1,0,0  
Ms=256  
Vi=200000  
Vm=2500000  
A=1000000  
D=A  
Hc=2  
Rc=75  
P=0  
 
'[PROGRAMS]
'The program block for this application sets
'the event that triggers the subroutine call
'when input 1 is active and loops when I1=inactive
 
PG 1  
LB Ga   'Program execution label
  P=0  
LB G1   'Loop back label
  CL Kb,I1=1
  H 10
  BR G1
E
 
'Subroutine from trigger event will execute
'a ten revolution positive move, hold, the
'return to 0 in the negative direction and repeat
'as long I1=1
 
LB Kb   'subroutine label
  MA 512000
  H  
  MA 0  
  H  
  RT  
PG   'exit program
'[END]
S              
'keep this line