4 - 2 4 - 2
MELSEC-Q
4 THE EXCHANGE BETWEEN THE PLC AND BUFFER MEMORY
4
4.2 The Exchange with the PLC
The following data exchange is performed between the PLC CPU and BASIC.
• Read and write of devices within the PLC CPU
• Read and write of the buffer memory within the special function module
• Read and write of the control of the PLC CPU
• Read and write of the sequence programs and parameters, etc.
The PCRD and PCWT instructions are used to perform these processes.
AD51H-BASIC can use floating decimal point data used by
AnA/AnU/AnUSCPU.
For details, see CVSMBF and MKSMBF functions.
4.2.1 Control tables
The idea of “Control Tables” is used since many parameters are required to execute
the PCRD and PCWT instructions. The control tables are a type of memory used to
hand over parameters that are used to notify the process contents to the system when
the above processes are performed by the BASIC program.
The BASIC program stores the necessary parameters in one array, and the
parameters are handed to the system by specifying only the array name during
execution.
For example, to read the device descriptions of the PLC CPU, the PLC station number,
device read designation, bit/word designation, read head device, number of points
read, and the parameter settings of the data storage variable must be set. If many
parameters are arranged following the instruction, the program becomes hard to read.
When the control tables are used, the actual instruction become easier to see, and the
parameters can be written so that they are understood easily.
Using Control Tables
100 RD%(0)=1
:’
Station Number
110 RD%(1)=1
:’
Read Designation
120 RD%(2)=2
:’
Word Unit
130 RD%(3)=1
:’
Device Code
140 RD%(4)=&H10
:’
Head Device No,
150 RD%(5)=1
:’
Reads 1 word
200 PCRD RD%( ), A%( )