4 ASCII protocol communication
CP340/CP341/CP440/CP441 Communication and Programming
Entry-ID: 88867653, V1.0, 02/2014
Siemens AG 2014 All rights reserved
4.4.3 Write communication program
1. Double-click OB1 to open the programming screen. Invoke SFB12 BSEND from
Libraries-> Standard library-> System function blocks, and distribute instance
data block DB12 to it and create send data block DB1.
Fig. 52: Send Data block DB1
2. Invoke send function block. The SFB12 BSEND parameters are set as shown in
the table below:
send request bit, rising edge trigger, which is M0.0 in this
example
Local ID number, which is obtained from the PtP connection
properties and is hexadecimal.
Distinguish double word, which may be any data. However, if the
program uses multiple BSEND blocks, different serial numbers
shall be distributed to them.
Data send area. DB area is used in this example, and the send
data are in 5 bytes.
Other addresses and data types may also be used for access,
and the detailed information may be obtained from Step7 SFB12
online help.
Send data length, which is counted in bytes.
Send complete bit, which is set as 1 if the task completes and has
no error.
Error bit, which is set as 1 in case of error.
Status word, indicating error code. The specific information may
be seen in online diagnosis of module or from CP441 Manual -
Chapter 9: Diagnosis information
Table 10: Parameter definition of SFB12 BSEND