CDS-3310
Chapter
7 Application Programming
i
33
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
#STOP,P1CH="0"
Check for S (stop motion)
JP #PAUSE,P1CH="1"
Check for P (pause motion)
JP #RESUME,P1CH="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
trip-point
and communication interrupt
#RESUME
Routine for resuming motion
SPA=rate
Set speed on A axis to original speed
EN1,1 Re-enable
trip-point
and communication interrupt
Example - Command Error
Instruction Interpretation
#BEGIN
Begin main program
IN "ENTER SPEED", speed
Prompt for speed
JG speed;BGA;
Begin motion
JP #BEGIN
Repeat
EN
End main program
#CMDERR Command
error
utility
JP#DONE,_ED<>2
Check if error on line 2
JP#DONE,_TC<>6
Check if out of range
MG "SPEED TOO HIGH"
Send message
MG "TRY AGAIN"
Send message
ZS1 Adjust
stack
JP #BEGIN
Return to main program
#DONE
End program if other error
ZS0 Zero
stack
EN End
program
The above program prompts the operator to enter a jog speed. If the operator enters a number out of
range (greater than 8 million), the #CMDERR routine will be executed prompting the operator to enter
a new number.
In multitasking applications, there is an alternate method for handling command errors from different
threads. Using the XQ command along with the special operands described below allows the
controller to either skip or retry invalid commands.
Summary of Contents for CDS-3310
Page 26: ...18 i Chapter 2 Getting Started CDS 3310 THIS PAGE LEFT PLANK INTENTIONALLY...
Page 32: ...24 i Chapter 3 Connecting I O CDS 3310 THIS PAGE LEFT PLANK INTENTIONALLY...
Page 124: ...CDS 3310 Chapter 8 Hardware Software Protection i 63 THIS PAGE LEFT PLANK INTENTIONALLY...
Page 138: ...CDS 3310 Chapter 10 Theory of Operation i 77 THIS PAGE LEFT BLANK INTENTIONALLY...