Siemens SIMATIC CP 440 Manual page 145

Installation and parameter assignment
Table of Contents

Advertisement

Description of the FC 23 (GEN BCC)
The "DB_NO" input parameter specifies the DB in which the data to be sent is
stored. The "LEN" input parameter specifies the length of the data to be sent. The
last two bytes should be reserved for the block check (stored as an ASCII value).
The block check is executed by means of an XOR logical operation of all the bytes
to be sent (LEN –2). The XOR logical operation occurs in the "LOOP". The
relevant byte is loaded with the L DBB [#d_loop_akt] command. The "#d_loop_akt"
offset must be specified as a bit offset. After "LOOP" is executed, the block check
is in the low byte of the "#w_bcc_value" variable. The block check is then encoded
in two ASCII characters as described in the example below.
Example:
Generation of BCC HI ASCII characters "32" =2
#w_bcc_value
UW
SLW 4
OW
Generation of BCC LO ASCII characters "35" =5
#w_bcc_value
UW
OW
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 incorrect
Point-to-point connection CP 440 Installation and Parameter Assignment
A5E00057742-02
0025
w#16#F0
00F0
____
= 0020
0200
w#16#3000
3000
____
= 3200
0025
w#16#F
000F
____
= 0005
w#16#30
0030
____
= 0035
Programming Example – Standard Blocks
//Hide lower half-byte
// Push a half-byte to the left
// Job 3000 Hex
//Hide upper half-byte
//Job 30 Hex
9-11

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents