Communication with External Devices
FP2 Serial Data Unit
4 − 5
4.1 Overview of Communication with External Devices
4.1.2 Receiving Data from External Device
Overview of data reception
FP2
CPU unit
FP2 serial data unit
Shared memory
Data receiving
RS232C
device
Data reading using
F150(READ) instruction
“Reception completed flag” contact goes on
Data input from the RS232C port is stored in the received buffer of the shared memory,
and the “Reception completed flag” is turned on. This data is then read using the F150
(READ) instruction of the ladder program, and is stored in a data register or another area
of the CPU unit.
Sample program for data reception
Data received through the RS232C port is read to DT100.
X1
R10
DF
,K0
, K251 , K5 , DT100
R10
X1 Y11
F150 READ
Specifies the FP2 serial data unit in
slot no. 0.
The contents of 5−word of shared memory
addresses 251 to 255
is read to the data register DT 100 to DT 104.
The internal relay (R10) is turned
on at the “Reception Completed
(X1)” timing.
The data is read from the address
251 area of the shared memory
(the received buffer of CH1).
When reception and reading of
the data have been completed,
Y11 is turned on, and the received
buffer is cleared.
The program described above is executed in the following sequence.
1
Data is received from the RS232C device to the received buffer of the shared memory.
2
The “Reception Completed (X1) contact” from the serial data unit is turned on.
3
The 5−word of data is read from the address 251 area of the shared memory in the serial data
unit (the received buffer of CH1), to an area which has DT100 of the data register as its starting
area.
4
The received buffer is cleared.
next page