Comments:
id specifies the route. See CALL PLCINIT above.
start address is the starting address of the register(s) you are interested in
reading.
[bit position] is an optional parameter which specifies the position within a
16 bit register to start reading from. An allowable range for bit position is 1
through 16. By specifying this parameter, a bit (single or multiple) read will
be performed. For example specifying a bit position of 2 will allow the read to
place the data at the PLC’s bit 2 (2^1) in the bit 0 (2^0 bit) position of the
variable/array (Note that all Eason documentation references bits 0 through
15 for bits inside variables in the EASON, while SY/MAX documentation
references bits 1 through 16 for registers in the PLC... sorry about the
confusion).. Note that only the contents of 1 register’s bits may be read at a
time. This means that a bit position of 9 (2^8 bit) will only allow 8 bits to be
read. This is due to the fact that there are only 16 bits available in one
register, and we are starting at bit 8 this leaves a result of 8 bits.
Omitting the bit position parameter will specify that the read will return
whole registers rather than bits. Refer to the following examples for samples
of how to specify bits or whole registers.
# of registers/bits is the number of consecutive registers, memory locations,
or bits that you wish to read. If the bit position parameter is omitted, # of
registers/bits will specify the number of 16 bit registers to read. If you wish
to read more than one register or memory location at a time, this number will
be the number of consecutive registers or locations you wish to read. If you
have included a bit position parameter, this number will be the number of
consecutive bits you wish to read.
variable/array is the variable name or array name where you wish to store
the data you are reading. If you are reading only one register or bit, you may
use any variable type you wish. If you are reading multiple registers, this
variable MUST be a short integer (%) array variable. If you are reading
registers or memory locations that are stored as words and the # of
registers/bits is greater than one, this will be a short integer array (make
sure you properly dimension the array prior to using it). If you are reading
the status of more than one, but less than 16 I/O bits, you will be reading one
word, and therefore will need to use a single short integer. Remember, any
time you are reading more than one register you must use a dimensioned
short integer array.
Examples:
10 DIM regdat%(10)
20 CALL PLCREAD(1,16,,5,regdat%(4))
This command returns the contents of register 16 in regdat%(4), register 17
in regdat%(5), register 18 in regdat%(6), register 19 in regdat%(7), and
register 20 in regdat%(8).
10 CALL PLCREAD(1,47,,1,regdat1%)
T-60 Operator's Manual
100