Mitsubishi Electronics T-60 Calculator User Manual


 
you wish to store the data you are reading. If the value of count (see above) is
1, this will be a variable expression. If you are reading 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 reading
the status of more than one, but less than 16 bits, you will be reading on
word, and therefore can use a discrete variable name. If you are reading
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 read the status of 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 reading 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 PLCREAD(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 returns
the contents of N7:16 in regdat%(1), N7:17 in regdat%(2), N7:18 in
regdat%(3), N7:19 in regdat%(4), and N7:20 in regdat%(5) in the SLC-500
with a node address of 1.
10 CALL PLCREAD(2,5,5,3,,1,reg%)
This command reads the data in C5:3 in an SLC-500 with node address of 2
and stores it in the variable reg%
20 CALL PLCREAD(1,3,3,1,8,15,stat%)
This command would access B3:1 in the PLC with a node address of 1. It
would return the status of B3:1/8 through B3:2/7 stat%. 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.
T-60 Operator's Manual
82