Rockwell Automation 57C610 Enhanced Basic Language, AutoMax User Manual
Page 61

6Ć21
Any combination of the above variable types is permitted;
however, a PRINT to or INPUT from this specific channel
must always pass the same number and type of variables
and in the same order that the type field specifies.
depth = how many messages this channel can hold before it is
considered full; this value must be an integer constant or
expression; specified only for the OPEN CHANNEL
statement in the task that is reading from the channel.
The task that is reading data (i.e., that contains the OPEN CHANNEL
FOR INPUT statement), creates the channel. If a task that is writing
data to a channel runs before the task that is reading data from the
channel, the task writing data is suspended until the task that is
reading data runs.
If a task tries to write data to a channel that is full (has reached the
maximum DEPTH), then that task will be suspended until one of the
queued messages is read by the task reading from the channel. If a
task attempts to read from a channel which is empty, that task will
be suspended until a message has been placed in the channel.
Note that the INPUT statement has a parameter (EMPTY) that allows
the task reading from the channel to transfer control to another line if
the channel is empty. The PRINT statement has a parameter (FULL)
that allows the task writing to the channel to transfer control to
another line if the channel is full.
Reading and writing to a channel can be used to synchronize
activities between two or more tasks. For example, task 1 could
perform some initialization and then INPUT from a channel. If the
channel is empty the task will be suspended until another task
PRINTs to the channel. Task 1 could then become active again when
one of several other tasks PRINTs information into the channel (such
as error or warning conditions). Task 1 could then record this
information and INPUT from the channel again, suspending the task
until more information is available.
The following are two examples of OPEN CHANNEL statements and
the corresponding INPUT and PRINT statements from that channel:
Task ABC
10 OPEN CHANNEL FOR OUTPUT AS FILE #1, TYPE = (I,I,S,R)
ąąă.
ąąă.
ąąă.
95 PRINT #1,(GAIN%*13),SPEED%,MESSAGE$,RATIO
ąąă.
ąąă.
ąąă.
Task XYZ
15 OPEN CHANNEL FOR INPUT AS FILE #1, TYPE = (I,I,S,R), DEPTH = 10
ąąă.
ąąă.
ąąă.
75 INPUT#1,NEW_GAIN%,CALC_SPEED%,TEXT$,RATIO
ąąă.
ąąă.
ąąă.
Note that the PRINT and INPUT statements have the same format
here as when they are used to access a device, except that OPEN
CHANNEL is used to define the logical channel number instead of
OPEN device_name." See section 6.8.