Cp440 Ascii Bcc" Program Example - Siemens SIMATIC S7-400 CP 440 Installation And Parameter Assignment

Point-to-point connection
Table of Contents

Advertisement

9.6.3

"CP440 ASCII BCC" Program Example

Structure of the Program Example
This program example only makes sense for the ASCII driver.
This example is set up identically to the "CP440 SEND RECV" example but also contains the
following:
● A block check sum is generated in the send section by calling FC 23 (GEN BCC)
● The block check sum is checked in the receive section with the call of FC 24 (CHK BCC)
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
Table 9-6
#w_bcc_value
UW w#16#F0
SLW 4
OW w#16#3000
Table 9-7
#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] )
Point-to-point connection CP 440 Installation and Parameter Assignment
Manual, 09/2007, A5E00057742-03
www.gkbpx.com
Generation of BCC HI ASCII characters "32" =2
0025
00F0
//Hide lower half-byte
= 0020
0200
//Push a half-byte to the left
3000
//Request 3000 Hex
= 3200
Generation of BCC LO ASCII characters "35" =5
0025
000F
//Hide upper half-byte
= 0005
0030
//Request 30 Hex
= 0035
Programming Example for Standard Function Blocks
9.6 Activation, Startup Program and Cyclic Program
该文档是极速PDF编辑器生成,
如果想去掉该提示,请访问并下载:
http://www.jisupdfeditor.com/
135

Advertisement

Table of Contents
loading

Table of Contents