34
•
Chapter 7 Application Programming
CDS-3310
OPERAND FUNCTION
_ED1
Returns the number of the thread that generated an error
_ED2
Retry failed command (operand contains the location of the failed command)
_ED3
Skip failed command (operand contains the location of the command after the failed
command)
The operands are used with the XQ command in the following format:
XQ _ED2 (or _ED3),_ED1,1
Where the “,1” at the end of the command line indicates a restart; therefore, the existing program stack
will not be removed when the above format executes.
The following example shows an error correction routine which uses the operands.
Example - Command Error with Multitasking
Instruction Interpretation
#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 – Ethernet Communication Error
This simple program executes in the CDS-3310 and indicates (via the serial port) when a
communication handle fails. By monitoring the serial port, the user can re-establish communication if
needed.
Instruction Interpretation
#LOOP Simple
program
loop
JP#LOOP
EN
#TCPERR
Ethernet communication error auto routine
MG {P1}_IA4
Send message to serial port indicating which handle
did not receive proper acknowledgment.
RE
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...