EasyManua.ls Logo

Galil Motion Control DMC-40 0 Series - Page 136

Galil Motion Control DMC-40 0 Series
283 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Example - Command Error w/Multitasking
#A
Begin thread 0 (continuous loop)
JP#A
EN
End of thread 0
#B
Begin thread 1
N=-1
Create new variable
KP N
Set KP to value of N, an invalid value
TY
Issue invalid command
EN
End of thread 1
#CMDERR
Begin command error subroutine
IF _TC=6
If error is out of range (KP -1)
N=1
Set N to a valid number
XQ _ED2,_ED1,1
Retry KP N command
ENDIF
IF _TC=1
If error is invalid command (TY)
XQ _ED3,_ED1,1
Skip invalid command
ENDIF
EN
End of command error routine
Example - Communication Interrupt
A DMC-4010 is used to move the A axis back and forth from 0 to 10000. This motion can be paused, resumed and
stopped via input from an auxiliary port terminal.
#BEGIN
Label for beginning of program
CC 9600,0,1,0
Setup communication configuration for auxiliary serial port
CI 2
Setup communication interrupt for auxiliary serial port
MG {P2}"Type 0 to stop motion"
Message out of auxiliary port
MG {P2}"Type 1 to pause motion"
Message out of auxiliary port
MG {P2}"Type 2 to resume motion"
Message out of auxiliary port
rate=2000
Variable to remember speed
SPA=rate
Set speed of A axis motion
#LOOP
Label for Loop
PAA=10000
Move to absolute position 10000
BGA
Begin Motion on A axis
AMA
Wait for motion to be complete
PAA=0
Move to absolute position 0
BGA
Begin Motion on A axis
AMA
Wait for motion to be complete
JP #LOOP
Continually loop to make back and forth motion
EN
End main program
#COMINT
Interrupt Routine
JP #STOP,P2CH="0"
Check for S (stop motion)
JP #PAUSE,P2CH="1"
Check for P (pause motion)
JP #RESUME,P2CH="2"
Check for R (resume motion)
EN1,1
Do nothing
#STOP
Routine for stopping motion
STA;ZS;EN
Stop motion on A axis; Zero program stack; End Program
#PAUSE
Routine for pausing motion
rate=_SPA
Save current speed setting of A axis motion
SPA=0
Set speed of A axis to zero (allows for pause)
EN1,1
Re-enable trippoint and communication interrupt
#RESUME
Routine for resuming motion
SPA=rate
Set speed on A axis to original speed
EN1,1
Re-enable trippoint and communication interrupt
For additional information, see section on Using Communication Interrupt.
Example – Ethernet Communication Error
This simple program executes in the DMC-40x0 and indicates (via the serial port) when a communication handle
fails. By monitoring the serial port, the user can re-establish communication if needed.
Chapter 7 Application Programming ▫ 131 DMC-40x0 User Manual

Table of Contents

Other manuals for Galil Motion Control DMC-40 0 Series

Related product manuals