Cp440 Master" Program Example - Siemens SIMATIC S7-400 Equipment Manual

Hide thumbs Also See for SIMATIC S7-400:
Table of Contents

Advertisement

Programming Example for Standard Function Blocks
9.6 Activation, Startup Program and Cyclic Program
Generation of BCC HI ASCII characters "32" =2
#w_bcc_value
UW w#16#F0
SLW 4
OW w#16#3000
Generation of BCC LO ASCII characters "35" =5
#w_bcc_value
UW w#16#F
OW w#16#30
The BCC is then written in word 20 of the data block (L DBW [#d_loop_akt] )
Description of the FC 24 (CHK BCC)
The program of the FC24 is largely identical to that of the FC23. At the end, the calculated block
check is compared with the block check of the received data. The #RETVAL output parameter is
output:
• 0: Block check OK or
• -1: Block check error
9.6.4

"CP440 MASTER" Program Example

This example describes the communication between a master and several slaves. You can find
the program sections for the individual slaves in the "CP440 SLAVE" program example.
In OB1 the pattern is set for communication with a partner. The branch table in the "Select Slave"
program section is used for this. Depending on the value in MW 8, either communication to slave
1 (FC 1 call) or 2 (FC 2 call) is selected. The program can be adapted to include additional slaves.
In FC 1 a send job ("execute new Send-Job" program section with FC 11 call) and the associated
receive job ("execute Recv-Job" program section with FC 21 call) are called by the slave for the
response. The counter "START_TIMER" for monitoring the response is started with the send job.
If the slave does not respond within the set monitoring time, the timed period expires and there
is a switch to the next slave.
114
0025
00F0
//Hide lower half-byte
= 0020
0200
//Push a half-byte to the left
3000
//Request 3000 Hex
= 3200
0025
000F
//Hide upper half-byte
= 0005
0030
//Request 30 Hex
= 0035
Point-to-point connection CP 440 Installation and Parameter Assignment
Equipment Manual, 03/2022, A5E00057742-AE

Advertisement

Table of Contents
loading

Table of Contents