
4-53
4 Using Protocol Macros
CJ-series Serial Communications Units Operation Manual for NJ-series CPU Unit(W494)
4-3 Usin
g Pr
otoco
l Macr
o
s
4
4-3-2 U
s
er Prog
ram Example
(2) Before you execute the communications sequence, copy the data in the user-defined vari-
ables for CJ-series memory starting from RecvData[1] with the size specified with Recv-
Data[0] -1, and overwrite the data to the reception buffer (excluding the first word). This
becomes the initial value of the reception buffer, and the results of Recv command execution
are waited for.
If the contents of the reception buffer exceeds the contents of the number of words specified
in RecvData[0] (or the whole area if the number of words is specified as 00), the value in the
reception buffer stays at the initial value of 16#0000.
(3) The data that is received as a result of Recv command execution will be stored in the recep-
tion buffer (excluding the first word) from the specified first word (offset) and will be verified
against the expected receive messages. If writing the response data is not specified, the
receive data will be saved in the reception buffer and will not be stored in the CPU Unit.
(4) If writing the response data is specified, the data in the reception buffer up to the last data
(excluding the first word), will be stored in the memory area used for CJ-series Units from
RecvData[1] onwards. The data stored for the number of words (including RecvData[0]) up to
the last word will be saved. Whenever the number of data words stored exceeds the maxi-
mum, the number of words in RecvData[0] will be updated.
(5) Steps 3 and 4 are repeated until the protocol macro operation is completed.
Additional Information
Processing When a Sequence Ends Abnormally
As shown in the following examples, if End is set when a sequence ends normally and Abort is
set when a sequence ends abnormally, it is possible to determine whether each sequence ended
normally or abnormally by using the Sequence End Completion Flag and the Sequence Abort
Completion Flag.
Reception buffer
Overwrites
initial value
User-defined
variable
No. of words
specified here
User-defined
variable
Set
CPU Unit
Serial Communications
Unit
Reception
buffer
After ExecPMCR
instruction is
executed
the internal
processing buffer is
cleared
Stores
receive data
Write response specified
Stored from the
specified first word
Offset
Receive data
Overwrites receive data
Recv
Changed
No. of words stored
is updated.
SendData[0]
SendData[1]
SendData[4]
RecvData[0]
RecvData[1]
RecvData[4]
Содержание CJ1W-SCU22
Страница 192: ...4 Using Protocol Macros 4 56 CJ series Serial Communications Units Operation Manual for NJ series CPU Unit W494...
Страница 250: ...6 No protocol Mode 6 22 CJ series Serial Communications Units Operation Manual for NJ series CPU Unit W494...
Страница 460: ...A Standard System Protocol R 126 CJ series Serial Communications Units Operation Manual for NJ series CPU Unit W494...
Страница 473: ...Index 1 CJ series Serial Communications Units Operation Manual for NJ series CPU Unit W494 I Index...