MITSUBISHI ELECTRIC T-60 User Manual
Page 92
you wish to store the data you are writing. If the value of count (see above) is
1, this could be a variable expression. If you are writing elements that are
stored as words and count is greater than one, this will be an array (make
sure you properly dimension the array prior to using it). If you are setting
more than one, but less than 16 bits, you will be writing one word, and
therefore can use a discrete variable name. If you are setting more than 16
bits, you will need to use an array. The dimension of the array variable will
be the next integer greater than the desired number of bits divided by 16.
For example, if you wish to set bits 1-24 you will need to dimension your
array to at least two since 24/16 = 1.5 and two is the next greater integer.
Remember, any time you are writing more than one word of data (more than
one register or more than 16 bits) you must use a dimensioned array
variable.
Examples:
10 DIM regdat%(5)
20 CALL PLCINIT(1,1)
30 CALL PLCWRITE(1,7,7,16,,5,regdat%(1))
Line 10 dimensions the array regdat%(10) for future use, line 20 initializes
the PLC (this only needs to be done once in your program). Line 30 writes
the contents of regdat%(1) in N7:16, regdat%(2) in N7:17, regdat%(3) in
N7:18, regdat%(4) in N7:19, and regdat%(5) in N7:20 in the SLC-500 with a
node address of 1.
10 CALL PLCWRITE(2,5,5,3,,1,reg%)
This command writes the data contained in the variable reg% into C5:3 in an
SLC-500 with a node address of 2.
20 CALL PLCWRITE(1,3,3,1,8,15,stat%)
This command would write the contents of variable stat% into the PLC data
bits B3:1/8 through B3:2/7. Note that if your PLC’s program does not access
any elements from B3:2/8 through B3:255/15, an error will result. This is
because the SLC-500 protects (disables external access) to elements which
are above the highest accessed elements in a file. Normally this is not a
problem for most file types, and status types. B type files however, are
protected in bytes. The -SL5 interface reads and writes in words. Therefore,
if the -SL5 interface accesses any low bits within the PLC (bits 0 through 7),
make sure that your PLC program accesses any bits in the next higher byte.
The easiest way to insure that you will not have a problem is to make sure
your PLC program accesses the next higher word in memory.
20 CALL PLCWRITE(1,7,7,15,1,1,0)
This command writes a zero to bit location N7:15/1. Note the restrictions
mentioned in the example above.
T-60 Operator's Manual
84