4 ASCII protocol communication
CP340/CP341/CP440/CP441 Communication and Programming
Entry-ID: 88867653, V1.0, 02/2014
13
S
ie
m
e
n
s
A
G
2014
A
ll r
ig
h
ts
r
e
s
e
rv
e
d
5. Create receive data block DB10.
Fig. 14: Receive data block DB10
6. Invoke receive function block
The parameters of the receive function block FB2 P_RCV of CP340 are set as in
the table below:
LADDR
Start logic address in hardware configuration, which is 256 in this example
DB_NO
Send Data block number, which is 10(DB10) in this example
DBB_NO
Start address of Send Data, which is 0(DB10.DBB0) in this example
LEN
Length of receive data, which is MW2 in this example. This value is not 0 only
in the current cycle when data are received. The length of received data may
be determined by checking the MW4 value.
EN_R
Enable receive bit, which is M0.1 in this example.
R
Cancel communication, which is not available in this example
NDR
Receive complete bit, which is TRUE if Receive completes and has no error
ERROR
error bit, TRUE indicating that it has an error
STATUS
status word, ID error code. See CP340 manual for related descriptions
Table 4: Parameter definition of FB2 P_RCV
Fig. 15: Invoke FB2 P_SEND from OB1