7 Serial Communications
7 - 28
NX-series Communications Interface Units User’s Manual (W540)
7-6 User Programming to Receive Data
If the system configuration does not allow you to use serial communications instructions for CIF Units,
you must program processing for the serial communications protocol in the user program.
This section describes the processing that is pe
rformed to receive data in the user program.
Precautions for Correct Use
Refer to 1-4-2 Conditions for Using Serial Communications Instructions for CIF Units on page
1-8 for detailed conditions on using the serial co
mmunications instructions for CIF Units.
User programming must check the contents of the input notification data that was input from the CIF
Unit. If there is input data, the user programming must store it in the receive buffer.
If the receive data size is larger than the divided data size, the receive data is divided into pieces and
sent in multiple input data.
You can also use the input notification data to see if a
communications error has occurred.
User programming must create the output notification data
and output it to the CIF Unit. By outputting
the output notification data, the communications master tells the CIF Unit whether it received the input
notification data normally.
Depending on the communications protocol of the seria
l
communications device that is the source of
the receive data, there may be settings made for the reception start condition and reception completion
condition for the receive data.
The user programming must interpret the contents of th
e re
ceive data and determine when the recep-
tion start condition and reception completion condition are met.
However, if Number of Characters to
Determine the End is set as the reception completion condition,
you can check the End Detected in the Port Status in the input notification data to see if the reception
completion condition is met.
For protocols in which the receive data contains a CRC or other check code, the user programming
must
p
erform processing to confirm the check codes.
Observe the following precautions when you write the user pr
ogramming to receive data from the serial
line.
In each I/O refresh cycle, the CIF Unit sends the receive data in the
receive buffer to the CPU Unit or
communications master. Therefore, even if the size of receive data in the receive buffer is less than the
divided data size, the receive data is sent to the CPU Unit or communications master when I/O is
refreshed.
7-6-1 Checking Input Notification Data
7-6-2 Creating and Outputting Output Notification Data
7-6-3 Determining Conditions to Start Reception and Conditions for the
Completion of the Reception
7-6-4 Precautions for Writing User Programming to Receive Data
Operation When the Size of Receive Data in the Receive Buffer Is
Less Than the Divided Data Size