A - 35
Appendices
NX-series Communications Interface Units User’s Manual (W540)
A-4 Programming Samples
A
A-4-3 Programming Sample 2: Sending Data
This sample sends the following 26-bytes text string to the serial line: ABCDEFGHIJKLMNOPQRSTU-
VWXYZ.
This programming sample is for the example given in 7-4-1 Example of Sending Data on page
7-13.
The processes in the table in 7-4-1 Example of Sending Data on page
7-13 correspond to the CASE
statements in the ST program as follows:
The following variable table is set from the Support Software.
All of the variables that you registered in
the I/O map are registered as global variables.
Internal Variables
A-4-3 Programming Sample 2: Sending Data
Procedure
Step number in example of sending
data
Process CASE statement
--- Idle CASE 0
1 Outputting string from A to T CASE 1
2 Output response for A to T CASE 2
3 Sending A to T ---
4 Outputting UVWXYZ CASE 1
5 Output response for UVWXYZ CASE 2
6 Sending UVWXYZ ---
7 --- CASE 3
8 Confirming sending of UVWXYZ CASE 3
Variable Table
Name Data type Initial value Comment
SendSize UINT UINT#0 Total size of the send data in
bytes
SendDat ARRAY[0..39] OF
BYTE
[40(16#0)]
*1
*1. Set the size of the SendDat array to the following size or larger: Number of divisions of send data × Output
divided data size [bytes].
In this sample, the send data is divided into two divisions (A to T and U to Z) and the output divided data
size is 20 bytes, so the array size is 40.
Send data
TestDat STRING[27] "" Text string to send
SendDatOffset UINT UINT#0 Send data offset
LastDatFlag BOOL FALSE Final data flag
OutputDataLength UINT UINT#0 Output data size
SendRequest BOOL FALSE Send request flag
SendRequest_R_TRIG_instance R_TRIG Instance of R_TRIG instruction
InitialRequestTrigger BOOL FALSE Condition to establish commu-
nications
InitialRequestTrigger_R_TRIG_in-
stance
R_TRIG Instance of R_TRIG instruction
SendRequestTrigger BOOL FALSE Send execution condition
SendStage INT INT#0 Current state
ExpectedOutputSID USINT USINT#0 Expected value of Output SID
Respon
se
PreSendCompletedToggle BOOL FALSE Send Completed Toggle Bit
before sending da
ta