For example, the #POSERR subroutine will automatically be executed when any axis exceeds its position error limit.
The commands in the #POSERR subroutine could decode which axis is in error and take the appropriate action. In
another example, the #ININT label could be used to designate an input interrupt subroutine. When the specified
input occurs, the program will be executed automatically.
NOTE
: An application program must be running for #CMDERR to function.
Example - Limit Switch:
This program prints a message upon the occurrence of a limit switch. Note, for the #LIMSWI routine to function,
the DMC-42x0 must be executing an applications program from memory. This can be a very simple program that
does nothing but loop on a statement, such as #LOOP;JP #LOOP;EN. Motion commands, such as JG 5000 can still
be sent from the PC even while the “dummy” applications program is being executed.
#LOOP
Dummy Program
JP #LOOP;EN
Jump to Loop
#LIMSWI
Limit Switch Label
MG “LIMIT OCCURRED”
Print Message
RE
Return to main program
Download Program
:XQ #LOOP
Execute Dummy Program
:JG 5000
Jog
:BGX
Begin Motion
Now, when a forward limit switch occurs on the X axis, the #LIMSWI subroutine will be executed.
Notes regarding the #LIMSWI Routine:
1) The RE command is used to return from the #LIMSWI subroutine.
2) The #LIMSWI subroutine will be re-executed if the limit switch remains active.
The #LIMSWI routine is only executed when the motor is being commanded to move.
Example - Position Error
#LOOP
Dummy Program
JP #LOOP;EN
Loop
#POSERR
Position Error Routine
v1=_TEX
Read Position Error
MG “EXCESS POSITION ERROR”
Print Message
MG “ERROR=”,v1=
Print Error
RE
Return from Error
Download program
:XQ #LOOP
Execute Dummy Program
:JG 100000
Jog at High Speed
:BGX
Begin Motion
Example - Input Interrupt
#A
Label
II1
Input Interrupt on 1
JG 30000,,,60000
Jog
BGXW
Begin Motion
#LOOP;JP#LOOP;EN
Loop
#ININT
Input Interrupt
STXW;AM
Stop Motion
#TEST;JP #TEST, @IN[1]=0
Test for Input 1 still low
JG 30000,,,6000
Restore Velocities
BGXW
Begin motion
RI0
Return from interrupt routine to Main Program and do not re-enable trippoints
Chapter 7 Application Programming ▫ 114
DMC-42x0 User Manual
Содержание DMC-42 0 Series
Страница 85: ...Chapter 6 Programming Motion 81 DMC 42x0 User Manual Figure 6 14 ECAM cycle with Z axis as master...
Страница 195: ...ICM 2900 PCB Layout Appendices 191 DMC 42x0 User Manual...
Страница 205: ...CB 50 100 Drawings Appendices 201 DMC 42x0 User Manual...
Страница 206: ...Appendices 202 DMC 42x0 User Manual...
Страница 207: ...Appendices 203 DMC 42x0 User Manual...
Страница 208: ...Appendices 204 DMC 42x0 User Manual...
Страница 209: ...Appendices 205 DMC 42x0 User Manual...
Страница 210: ...Appendices 206 DMC 42x0 User Manual...
Страница 211: ...Appendices 207 DMC 42x0 User Manual...
Страница 214: ...CB 50 80 Drawing Appendices 210 DMC 42x0 User Manual...
Страница 215: ...Appendices 211 DMC 42x0 User Manual...