3. Instructions
900
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Function
PMCR2 calls and executes a communications sequence (protocol data) registered in a Serial
Communications Board or Serial Communications Unit. PMCR2 will execute the communications
sequence specified in C2 using the port specified in C1. If a symbol is specified as the operand for a
send message, the number of send words specified in S and beginning from S+1 will be used as the
send area. If a symbol is specified as the operand for a receive message, receive data is placed in
memory starting with R+1 and the number of words received is automatically written to R if the
transmission is successful.
When the transmission starts, the Execution Completed Flag in I is turned OFF. When a response is
returned, the transmission result is shown in the Error Flag in I. The communications response is
written to I+1.
Example Programming
If CIO 0.00 (start bit) and A202.08 (CJ2 Instructions Enabled Flag) are ON, W10.00 (executing) will turn
ON. When W10.00 (executing) turns ON, communications sequence 101 (101 decimal or 0065 hex) is
executed. If a symbol is specified as the operand for the send message, the two words beginning from
D101 will be used as the send area (D100 contains 0003 hex).
If a symbol is specified as the operand for the receive message, receive data is placed in memory
starting with D201 and the number of words received (counting D200) is automatically written to D200 if
the transmission is successful.
If communications end normally, CIO 2.00 (execution completed) turns ON, and normal processing is
executed. If communications end in an error, CIO 2.01 (error end) turns ON, and error processing is
executed.
z Timing Chart
Note As shown above, the symbol read option, R( ), in the
send message or the symbol write option, W( ), in the
receive message, actually sends/receives data
Normal
processing
Error
processing
KEEP
W10.00
PMCR2
#02E1
&101
D100
D200
2
C1
C2
S
R
I
0.00 A202.08
Start bit
CJ2 Instructions
Enabled Flag
W10.01
Execution completed
W10.00
Executing
W10.00 2.00 2.01
2.01
W10.01
Executing Execution
completed
Error end
Error end
Execution completed
C2
0
15
C1 0 2
Unit address of communications partner
#10: CPU Bus Unit with unit number 0
8
1112
34
15
07
10
&101
Serial port number (physical port)
2 hex: Port 2
Always 0.
D100
D101
D102
0 0 0 3
0 1 0 0
0 0 0 3
0 1 0 0
D200
D201
0 0 0 2
0 2 0 0
0 2 0 0
Communications sequence number
0065 hex: 101 decimal
Sent
R(1),2: 2 bytes sent from
D101
Used as
send area
Received
W(1),2: 2 bytes received
starting from D201
Data received
from external
device
1 word
1 word
Start bit
CIO 0.00
Executing
W10.00
Execution
completed
CIO 2.00
Execution
completed
W10.01
1
0
1
0
1
0
1
0
Communications in progress
PMCR2 started
PMCR2 completed