3. Instructions
874
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Example Programming
When CIO 0.00 is ON, A202.03 (the Communications Port Enabled Flag) is ON, and CIO 1559.05 (the
TXDU Instruction Executing Flag for port 1) is OFF in the following example, TXDU(256) outputs data
through serial port 1 of the Serial Communications Unit with unit number 2. The 5 bytes of output data
are read from the DM Area beginning at the rightmost byte of D100 and output through logical port 3 to
a general-purpose device such as a printer.
C+0: D200
0
0 7 815
0
11 12
3
0 7 815
1
11 12
0 1
4 3
1 2
4 3
S: D100
0 7 815
4 1 23
D101
D A BC
D102
E F
1 2 3 4 A B C D E F
3412ST AB CD EF ED
C+1:
3
0 7 815
0
11 12
8 8
4 3
D30204
0 7 815
2
11 12
0 3
4 3
0
D30205:
0 7 815
1
11 12
4 3
1
Always 00
RS and ER signal control
0: No RS and ER signal control
Byte order
1: Least significant bytes first
Communications Port
Enabled Flag
TXDU Instruction
Executing Flag
C+1: D201
Serial Communications Unit's unit address (Unit
address as CPU Bus Unit)
12 hex = Unit number + 10 hex
Serial port number
1: Port 1
Note:
The serial port's unit address can be specified directly by setting the serial port number to 0 and
setting the Serial Communications Unit's unit address to the serial port's unit address.
(Set the unit address to 80 hex + 4 × unit number for port 1 or 81 hex + 4 × unit number for port 2.)
Port number specifier
3: Logical port 3
Serial Communications Unit's unit address
88 hex = 80 hex + 4 x unit number
Serial port number
0: Specify port directly.
Port number specifier
3: Logical port 3
Data sent.
In this example, a start and end code have been
specified in the allocated DM Setup Area.
ST: Start code (e.g., 02 hex)
ED: End code (e.g., 03 hex)
Most signifi-
cant bytes
Least signif-
icant bytes
Transfer order
5 bytes
Example allocated DM Setup Area settings:
Start code
(02 hex)
End code
(03 hex)
Start code and end code values
Start code and end code specifiers
End code specifier
(1: Use end code.)
Start code specifier
(1: Use start code.)
TXDU
D100
D200
&5
1559.05A202.03
S
C
N
0.00