17.03.2014 Views

DVP-ES2-EX2-SS2-SA2-SX2-Operation Manual

DVP-ES2-EX2-SS2-SA2-SX2-Operation Manual

DVP-ES2-EX2-SS2-SA2-SX2-Operation Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4. Communications<br />

Field Name<br />

Example (Hex)<br />

Data Lo (T24) 05<br />

Data Hi (T25) 00<br />

Data Lo (T25) 06<br />

Data Hi (T26) 00<br />

Data Lo (T26) 07<br />

Data Hi (T27) 00<br />

Data Lo (T27) 08<br />

CRC CHK Low 72<br />

CRC CHK High 98<br />

END<br />

No data input ≥ 10 ms<br />

4.3.3 CRC CHK (check sum)<br />

The CRC Check starts from “Slave Address” and ends in “The last data content.” Calculation of CRC:<br />

Step 1: Set the 16-bit register (CRC register) = FFFFH.<br />

Step 2: Operate XOR on the first 8-bit message (Address) and the lower 8 bits of CRC register. Store<br />

the result in the CRC register<br />

Step 3: Right shift CRC register for a bit and fill “0” into the highest bit.<br />

Step 4: Check the lowest bit (bit 0) of the shifted value. If bit 0 is 0, fill in the new value obtained at step<br />

3 to CRC register; if bit 0 is NOT 0, operate XOR on A001H and the shifted value and store the result in<br />

the CRC register.<br />

Step 5: Repeat step 3 – 4 to finish all operation on all the 8 bits.<br />

Step 6: Repeat step 2 – 5 until the operation of all the messages are completed. The final value<br />

obtained in the CRC register is the CRC checksum. Care should be taken when placing the LOW byte<br />

and HIGH byte of the obtained CRC checksum.<br />

Calculation example of the CRC Check using the C language:<br />

unsigned char* data // index of the command message<br />

unsigned char length // length of the command message<br />

unsigned int crc_chk(unsigned char* data, unsigned char length)<br />

{<br />

int j;<br />

unsigned int reg_crc=0Xffff;<br />

while(length--)<br />

4-9

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!