User guide
11/25/96
➆
6270 Programming Tips
91
Example Description
DCLEARØ Clear RP240 display
DWRITE"HIT F4" Send message to RP240 display
VAR3=DREADF Wait for data to be read from a RP240 function key (into
numeric variable 3)
IF (VAR3<>4) Evaluate expression to see if function key F4 was hit
DCLEAR2 Clear RP240 display line 2
DWRITE"YOU DIDN'T LISTEN" Send message to RP240 display
NIF End of IF
☞
RP240 Data Read
Immediate Mode
The DREADI1 command allows continual numeric or function key data entry from the RP240
(when used in conjunction with the DREAD and/or DREADF commands). In this immediate
mode, program execution is not paused (waiting for data entry) when a DREAD or DREADF
command is encountered. Refer to the 6000 Series Software Reference Guide for
programming examples.
NOTES
❏ While in the Data Read Immediate Mode, data is read into numeric (VAR) variables only.
❏ This feature is not designed to be used in conjunction with the RP240's standard menus
(see
RP240
section above); the RUN, JOG, and DJOG menus will disable the DREADI mode.
❏ Do not assign the same variable to read numeric data & function key data—pick only one.
Conditional
Looping
The 6250 supports two conditional looping structures—REPEAT/UNTIL and WHILE.
REPEAT /
UNTIL
All commands between REPEAT and UNTIL are repeated until the expression contained
within the parenthesis of the UNTIL command is true. The example below illustrates how a
typical REPEAT/UNTIL conditional loop works.
Command Description
> VAR5=Ø Initializes variable 5 to 0
> DEF prog1Ø Defines program
prog10
- INFNC1-A Input 1 is not assigned a function, used with IN
- INFNC2-A Input 2 is not assigned a function, used with IN
- INFNC3-A Input 3 is not assigned a function, used with IN
- INFNC4-A Input 4 is not assigned a function, used with IN
- OUTFNC1-A Output 1 is programmable
- A5Ø Acceleration is 50 rps
2
- AD5Ø Deceleration is 50 rps
2
-V5 Sets velocity to 5 rps
- D4ØØØ Distance is 4,000 steps
- REPEAT Begins the REPEAT loop
- GO1 Executes the move (Go)
- VAR5=VAR5+1 Variable 5 counts up from 0
- UNTIL(IN=b111Ø OR VAR5>1Ø) When the inputs 1-4 are 111Ø, respectively or
VAR5 is greater than 10, the loop will stop.
- OUT1 Turn on output 1 when finished with REPEAT loop
- END End program definition
> RUN prog1Ø Initiate program
prog10
The REPEAT loop in the example above will execute 1 time, at which point the expression stated
within the UNTIL command will be evaluated. If the expression is true, command processing
will continue with the first command following the UNTIL command. If the expression is false,
the REPEAT loop will be repeated.