Programming Example – Standard Blocks
9-11
Point-to-point connection CP 440 Installation and Parameter Assignment
A5E00057742-02
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
0025
UW w#16#F0
00F0
//Hide lower half-byte
____
= 0020
SLW 4
0200
// Push a half-byte to the left
OW w#16#3000
3000
// Job 3000 Hex
____
= 3200
Generation of BCC LO ASCII characters “35” =5
#w_bcc_value
0025
UW w#16#F
000F
//Hide upper half-byte
____
= 0005
OW w#16#30
0030
//Job 30 Hex
____
= 0035
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
Содержание SIMATIC CP 440
Страница 10: ...Contents x Point to point connection CP 440 Installation and Parameter Assignment A5E00057742 02 ...
Страница 134: ...Diagnostics with the CP 440 8 16 Point to point connection CP 440 Installation and Parameter Assignment A5E00057742 02 ...
Страница 164: ...Accessories and Order Numbers D 2 Point to point connection CP 440 Installation and Parameter Assignment A5E00057742 02 ...