86 • Chapter 7 Application Programming DMC-1500
:ED Edit Mode
000 #A Program Label
001 PR1000 Position Relative 1000
002 BGX Begin
003 PR5000 Position Relative 5000
004 EN End
<cntrl> Q Quit Edit Mode
:XQ #A Execute #A
?003 PR5000 Error on Line 3
:TC1 Tell Error Code
?7 Command not valid
while running.
Command not valid while running
:ED 3 Edit Line 3
003 AMX;PR5000;BGX Add After Motion Done
<cntrl> Q Quit Edit Mode
:XQ #A Execute #A
Debugging Programs
Commands
The DMC-1500 provides trace and error code commands which are used in debugging programs. The
trace command causes the controller 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.
When there is a program error, the DMC-1500 halts the program execution at the point where the error
occurs. The line number is then displayed.
The user can obtain information about the type of error condition that occurred by using the command,
TC1. This command reports back a number and a text message which describes 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.
The DMC-1500 provides the capability to check the available program memory and array memory.
The command, DM ?, will return the number of array elements currently available. The command,
DA ?, will return the number of arrays currently available. For example, a standard DMC-1510 will
have a maximum of 8000 array elements in up to 30 arrays. If an array of 100 elements is defined, the
command DM ? will return the value 1500 and the command DA ? will return 13.
Operands
The operand _ED will return the value of the last line executed and can be used to determine where an
error occurred. For example, the command MG _ED will display the line number in the program that
failed.
The operand _DL returns the number of available labels.
The operand _UL returns the number of available variables.
The operand _DA returns the number of available arrays.