This command reads the data in register number 47 with and stores it in the
variable regdat1%.
10 CALL PLCREAD(1,100,5,2,bits%)
This command reads two bits from register 100 starting at bit position 5. The
result is placed in the variable bits% with register 100, bit 5 in bit position 0,
and register 100 bit 6 in bit position 6.
CALL PLCWRITE Statement
Purpose:
This command is used to write 16 bit words and bits into the SY/MAX PLC’s
‘register(s).
Syntax:
CALL PLCWRITE(id,start address,[bit position], # of
registers/bits,expression/variable/array)
Comments:
id specifies the route. See CALL PLCINIT above.
start address is the starting address of the register(s) you are interested in
writing.
[bit position] is an optional parameter which specifies the position within a
16 bit register to start writing to. An allowable range for bit position is 1
through 16. By specifying this parameter, a bit (single or multiple) write will
be performed. For example specifying a bit position of 2 will allow the write
to place data contained in the variable/array bit 0 (2^0 bit) in the bit 2 (2^1
bit) position of the result (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
written at a time. This means that a bit position of 9 (2^8 bit) will only allow
8 bits to be written. 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 write 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 write. If the bit position parameter is omitted, # of
registers/bits will specify the number of 16 bit registers to write. If you wish
to write more than one register or memory location at a time, this number
will be the number of consecutive registers or locations you wish to write (up
to a maximum of 16). If you have included a bit position parameter, this
number will be the number of consecutive bits you wish to write.
PLC Interface Commands PLC Specific Information
101