EasyManua.ls Logo

FATEK FBs-CB2 - CRC16 CALCULATION (FUN31 CRC16)

FATEK FBs-CB2
348 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Advanced Function Instruction
7-10
FUN31 P
CRC16
CRC16 CALCULATION
(CRC16)
FUN31 P
CRC16
HR ROR DR K
Range
Ope-
rand
R0
∣
R3839
R5000
∣
R8071
D0
∣
D4095
MD 0~1
S ○ ○ ○
N ○ ○ ○ 1~256
D ○ ○* ○
MD :0, Lower byte of registers to be calculated the
CRC16
:1, Reserved
S:Starting address of CRC16 calculation
N:Length of CRC16 calculation (In Byte)
D:The destination register to store the calculation of
CRC16,
Register D stores the Upper Byte of CRC16
Register D+1 stores the Lower Byte of CRC16
S, N, D may associate with V、Z、P0~P9 index register to
serve the indirect addressing application
● When execution control "EN"=1 or "EN↑"( P instruction)changes from 0→1, it will start the CRC16
calculation from the lower byte of S and by the length of N, the result of calculation will be stored into register
D and D+1.
● The output indication "D=0" will be ON if the value of calculation is 0.
● It will not execute the calculation and the output indication "ERR" will be ON if the length is invalid.
● When communicating with the intelligent peripheral in binary data fromat, the CRC16 error detection is used
very often; the well known Modbus RTU communication protocol uses this method for error detection of
message frame.
● CRC16 is the check value of a Cyclical Redundancy Check calculation performed on the message contents.
● Perform the CRC16 calculation on the received message data and error check value, the result of the
calculation value must be 0, it means no error within this message frame.
S :
D :
D0
V
08P.MOV
MD:
S :
N :
0
R0
D0
31P.CRC16
D :
R0V
M0
EN
EN
ERR
D=0
S D
High Byte Low Byte High Byte Low Byte
R0
Don’t care Byte-0 R10 00 CRC-Hi
R1
Don’t care Byte-1 R11 00 CRC-Lo
R2
Don’t care Byte-2
R3 Don’t care Byte-3
R4 Don’t care Byte-4
R5 Don’t care Byte-5
R6 Don’t care Byte-6
R7 Don’t care Byte-7
R8 Don’t care Byte-8
R9 Don’t care Byte-9
Description:When M0 changes from 0→1, it will execute the
CRC16 calculation starting from lower byte of R0, the length is
assigned by D0, and then stores the CRC value into register
R0+V and R0+V+1.
It is supposed D0=10, the registers R10 and R11 will store the
CRC16 value.