User guide
11/25/96
➆
6270 Programming Tips
93
The
ON condition
program must be defined (DEF) and specified (ONP) before enabling the ON
conditions with the ONCOND command (see example below).
Example
Command Description
> DEF onjump Begin definition of program onjump
- VAR1=VAR1+1 Increment variable 1
- END End program definition
> VAR1=Ø Initialize variable 1
> ONIN1 On input 1 branch to ON program
> ONP onjump ON program is onjump
> ONCOND1ØØØ Enable ONIN
At this point, the 6250 is configured to increment variable 1 when input 1 goes active. If input 1
does go active, control will be passed to the ONP program, the commands within the ONP
program will be executed, and control will then be passed back to the original program.
Program Debug Tools
After creating your programs, you may need to debug the programs to ensure that they are performing
the functions properly. The 6250 provides several debugging tools.
❏ In Trace mode, you can trace a program as it is executing.
❏ In Single-Step mode, you can step through the program one command at a time.
❏ Without an actual voltage present, you can simulate a specific voltage on the 6250's analog
input channels using the ANVO command.
❏ You can set the desired state of the 6250 's inputs and outputs via software commands.
❏ You can enable the 6250 to display error messages when it detects certain programming errors
as you enter them or as the program is run. When the 6250 detects an error with a command,
you can issue the TCMDER command to find out which command has the error.
Trace Mode
You can use the Trace mode to debug a program. The Trace mode allows you to track,
command-by-command, the entire program as it runs. The 6250 will display (on your RS-
232C terminal) all of the commands as the they are executed. Program tracing is also
available on the RP240 display (see RP240 section above). The following example
demonstrates the Trace mode.
Step
➀
Create program prog1:
Command Description
> DEF prog1 Begin definition of program prog1
- A1Ø Acceleration is 10 rps
2
- AD1Ø Deceleration is 10 rps
2
-V5 Velocity is 5 rps
-L3 Loop 3 times
- GOSUB prog3 Gosub to program #3
-LN Ends the loop
- END End definition of program prog1
Step
➁
Create program prog3:
Command Description
> DEF prog3 Begin definition of program prog3
- D8ØØØ Sets the distance to 8000 steps
- GO1 Initiates motion
- END End definition of program prog3
Step
➂
Enter the following command to enable the Trace mode:
Command Description
> TRACE1 Enables the Trace mode