CALL PLCREAD Statement
Syntax:
CALL PLCREAD(id, type, file, address, [bit], count, variable/array )
Comments:
This command is specific to the -SL5 Interface Option.
id specifies the address of the PLC from which you wish to read data. This
number is usually 1 when interfacing to one PLC. See the SLC-500 Setup
section for more information on the selection of the id.
type specifies the file type that is required for a specific file. The allowable
file types and their use are as follows:
0Outputs - The -SL5 option will not allow direct access to I/O.
1Inputs - The -SL5 option will not allow direct access to I/O.
2Status - S file types
3Bit - B file types
4Timer - T file types
5Counter - C file types
6Control - R file types
7Integer - N file types
file specifies the file number that you wish to access. The use of a specific
file is restricted to files which your program access. For instance, if your
program uses no timers, and you access a timer file you will get a “PLC LINK
NOT ESTABLISHED” error.
address is the address of the first element to access in the specified file.
Allen-Bradley restricts reading from or writing to locations which are not
specified within a program. For example if your program only access N7:0
through N7:4 and you try to read from N7:5 (one address higher than your
program access), you will get an error. To avoid this problem, we suggest
that your program access data at least one word higher than words that the
-SL5 interface is trying to access. When addressing bit files (type 3), you
must specify the WORD address, rather than the BIT address. For example
to access B3:250 you need to think of accessing word address B3:15/10. See
the examples at the end of this section for further clarification.
bit is the starting bit location of the bits you wish to read. If you are
reading words (as in reading a register value), leave this field blank
(i.e., ...address,,count,...). If you are reading bits in any file type, specify
the starting bit in the element you are addressing (address). This could be
any bit from 0-15.
count specifies the number of bits and/or elements that you wish to read. If
you are reading data in the form of words, it is the number of consecutive
elements you wish to read. If you are reading bits, it is the number of
consecutive bits you wish to read.
variable/array is the variable name or single dimension array name where
PLC Interface Commands PLC Specific Information
81