board and the contents of the program, array, and variable space. Operands also contain important status
information, which can help to debug a program.
Trace Commands
The trace command causes the RIO to send each line in a program to the host computer immediately prior to
execution. Tracing is enabled with the command, TR1. TR0 turns the trace function off. Note: When the
trace function is enabled, the line numbers as well as the command line will be displayed as each command
line is executed. The program lines come back as unsolicited messages.
Error Code Command
When a program error occurs, the RIO halts the program execution at the point of the error. To display the
last line number of program execution, issue the command, MG _ED.
The user can obtain information about the type of error condition that occurred by using the command TC1.
This command returns a number and text message, which describe the error condition. The command TC0
(or TC) will return the error code without the text message. For more information about the command TC,
see the Command Reference.
RAM Memory Interrogation Commands
For debugging the status of the program memory, array memory, or variable memory, the RIO has several
useful commands. The command DM ? will return the number of array elements currently available. The
command DA? will return the number of arrays that can be currently defined. For example, the RIO has a
maximum of 400 array elements in up to 6 arrays. If a single array of 100 elements is defined, the command
DM ? will return the value 250, and the command DA ? will return 5.
To list the contents of the variable space, use the interrogation command LV (List Variables). To list the
contents of array space, use the interrogation command LA (List Arrays). To list the contents of the program
space, use the interrogation command LS (List Program). To list the application program labels only, use the
interrogation command LL (List Labels).
Operands
In general, all operands provide information that may be useful in debugging an application program. Below
is a list of operands that are particularly valuable for program debugging. To display the value of an operand,
the message command may be used. For example, since the operand, _ED, contains the last line of program
execution, the command MG _ED will display this line number.
_ED contains the last line of program execution (useful to determine where program stopped)
_DL contains the number of available labels (62 max.)
_UL contains the number of available variables (126 max.)
_DA contains the number of available arrays (6 max.)
_DM contains the number of available array elements (400 max.)
Debugging Example:
The following program has an error. It attempts to set bit 14 high, but “SD” is used as the command instead
of “SB”. When the program is executed, the RIO stops at line 001. The user can then query the RIO board
using the command, TC1. The RIO responds with the corresponding explanation:
Instruction
Interpretation
:LS List
Program
000 #A
Program Label
RIO-47xxx
Chapter 5 Programming
●
53
Содержание RIO-47120
Страница 2: ......
Страница 93: ...RIO Dimensions RIO 471xx Units in centimeters RIO 47xxx Appendix 87...
Страница 94: ...RIO 472xx Units in millimeters 88 Appendix RIO 47xxx...
Страница 107: ...Internal 56 64 Zero Stack 53 RIO 47xxx Index 101...