FP2 Serial Data Unit
Communication with External Devices
4
−
4
4.1
Overview of Communication with External Devices
Sample program for data sending
This program sends the character “ABC123DEF456” to external device.
R0
R10
DF
, K0 , DT0
, K7
, K1
R10
R10
Y10
F151 WRT
R10
M ABC123DEF456 , DT0
F95 ASC ,
, H D
, DT7
F0 MV
X0
X0
Y10
Y10
Specifies the FP2 serial data unit in
slot no. 0.
The internal relay (R10) is turned on at
the timing of the sending condition
(R0).
The character “ABC123DEF456” is
converted to an ASCII code, and writ-
ten to DT0 to DT6.
The end code (C
R
) “0D” is written to
DT7.
The data is written to the address 1
area of the shared memory (the CH1
sent buffer).
After the sending starts, the sending
directive continues until the sending
has been completed.
The 7
−
word contents of data register
DT 0 to DT 7
is written to the shared memory
addresses 1 to 7.
The program described above is executed in the following sequence.
1
“ABC123DEF456” is converted to an ASCII code.
2
Data with an end code (H0D) added is stored in a data register.
3
The data is written to the sent buffer of the shared memory in the serial data unit.
4
The “Sending directive (Y10)” contact is turned on by the CPU unit.
5
Sending of data to RS232C device begins.
6
After the sending has been completed, the sent buffer is cleared.
Explanatory diagram
5
Data sending
3
Data writing
“ABC123DEF456”
1
Conversion of ASCII code
“H414243313233444546343536”
2
End code “H0D” adding
RS232C
device
Data register
Shared memory
DT0
Sent buffer
FP2 serial data unit
FP2 CPU unit
An end code is added to
the data converted to an
ASCII code, and the data
is stored in a data register.
4
Sending directive (Y10:on)
6
Sent buffer is cleared
Содержание FP2 Series
Страница 1: ......
Страница 6: ...FP2 Serial Data Unit Table of Contents iv ...
Страница 18: ...FP2 Serial Data Unit Functions of Serial Data Unit 1 2 ...
Страница 22: ...FP2 Serial Data Unit Functions of Serial Data Unit 1 6 1 3 Restrictions on Units Combination ...
Страница 24: ...FP2 Serial Data Unit Parts and Functions 2 2 ...
Страница 30: ...FP2 Serial Data Unit Confirming the Unit Settings and Design Contents 3 2 ...
Страница 44: ...FP2 Serial Data Unit Communication with External Devices 4 2 ...
Страница 66: ...FP2 Serial Data Unit Precautions Regarding Serial Data Unit Operation and Programs 5 2 ...
Страница 72: ...FP2 Serial Data Unit Operation If an Error Occurs 6 2 ...
Страница 78: ...FP2 Serial Data Unit Specifications 7 2 ...
Страница 86: ...FP2 Serial Data Unit Specifications 7 10 7 4 Transmission Format ...
Страница 88: ...FP2 Serial Data Unit Sample Programs 8 2 ...
Страница 98: ...FP2 Serial Data Unit Sample Programs 8 12 8 2 Table of ASCII Codes ...
Страница 100: ...Record of changes FP2 Serial Data Unit R 2 ...
Страница 101: ......
Страница 102: ......