EasyManua.ls Logo

Xinje XD Series - NEW FUNCTIONS

Xinje XD Series
456 pages
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...
328
C program
Method 2 can simplify the program.
The above C language function is similar to ladder chart of method 1, whose precision is not
high. If it needs to get the high precision, please use float calculation.
Example 2: Calculate CRC parity value via Func Block
CRC calculation rules:
(1)Set 16-bit register (CRC register) = FFFF H
(2)XOR (Exclusive OR) the first 8-bit byte message and the low 16-bit CRC register.
(3)Right shift 1 bit of CRC register, fill 0 into the highest bit.
(4)Check the right shifted value, if it is 0, save the new value from step3 into CRC register; if
it is not 0, XOR the CRC register value with A001 H and then save the result into the CRC
register.
(5)Repeat step3&4 until all the 8-bit have been calculated.
(6) Repeat step(2)~(5), then calculate the next 8-bit message. Until all the messages have been
calculated, the result will be the CRC parity code in CRC register.
Edit C language Function Block program, see graph below:
tudonghoatoancau.com

Table of Contents

Other manuals for Xinje XD Series