K-bus CRC Calculate
description
Transcript of K-bus CRC Calculate
K-BUS CRC SPECIFICATION
K-BUS CRC SPECIFICATION
1. An example for CRC of K-bus
Calculating FCS(CRC) for HDLC frame
up vote0down votefavoriteI have the following frame:
7e 01 00 00 01 00 18 ef 00 00 00 b5 20 c1 05 10 02 71 2e 1a c2 05 10 01 71 00 6e 87 02 00 01 42 71 2e 1a 01 96 27 be 27 54 17 3d b9 93 ac 7e
If I understand correctly, then it is this portion of the frame on which the FCS is calculated:
010000010018ef000000b520c1051002712e1ac205100171006e8702000142712e1a019627be2754173db9
I've tried entering this into a number of online calculators but I cant produce 0x93ac from the above data.
http://www.lammertbies.nl/comm/info/crc-calculation.htmlwith input type hex.
How is 0x93ac arrived at?
Thanks,
Barry
serial-portframechecksumcrcshare
HYPERLINK "http://stackoverflow.com/posts/7983862/edit" \o "" improve this questioneditedNov 3 '14 at 19:24
dsolimano5,60832339askedNov 2 '11 at 16:30
Baz90152684
add a comment
1 Answer
active
HYPERLINK "http://stackoverflow.com/questions/7983862/calculating-fcscrc-for-hdlc-frame?answertab=oldest" \l "tab-top" \o "Answers in the order they were provided" oldest
HYPERLINK "http://stackoverflow.com/questions/7983862/calculating-fcscrc-for-hdlc-frame?answertab=votes" \l "tab-top" \o "Answers with the highest score first" votesup vote4down voteacceptedfirst of all, CRC value is 0xac93
Use this calculator:http://www.zorc.breitbandkatze.de/crc.html Set CRC order 16
Polynomial 1021
Initial valueffff Final valueffff "reverse data bytes"
"reverse CRC result before Final XOR"
Enter your sequence as:
%01%00%00%01%00%18%ef%00%00%00%b5%20%c1%05%10%02%71%2e%1a%c2%05%10%01%71%00%6e%87%02%00%01%42%71%2e%1a%01%96%27%be%27%54%17%3d%b9`
Press "calculate" and you get 0xAC93
share
HYPERLINK "http://stackoverflow.com/posts/8841442/edit" \o "" improve this answereditedJan 12 '12 at 21:11
Peter O.12.3k63546answeredJan 12 '12 at 19:57
Ilya562
2. Result calculate K-bus from Relay with stream : 0100026140 024F(http://www.zorc.breitbandkatze.de/crc.html)
3. IEC870 to Kbus Frame (FT1.2)3.1 IEC870
680303684001004116
STARTLENLENSTARTFCADDDATA1CHECKSUMSTOP
START = 68H, STOP = 16, CHECKSUM = FC+DATA1+DATA23.1 KBUS7E0100026140024F7E
FLAGADD?LEN?FCCRC1CRC2FLAG
CRC: CCITT, X16+X12+X5+1
Set CRC order 16
Polynomial 1021
Initial value ffff
Final value ffff
"reverse data bytes"
"reverse CRC result before Final XOR"IEC FRAME
680707687B0100071404009B16
FCADDADDCHKSTOP
KBUS FRAME
010006617B07140400E743
LEN?FC
Note: K-bus HDLC is serial LSB First
PC
TX: 68 07 07 68 |7B 01 00 07 14 04 00| 9B 16
KBUS
TX: 01 00 06 61 |7B 07 14 04 00| E7 A3
PC RX: 68 0B 0B 68 |08 01 00 38 04 8A 3C 2A 01 5D 68| FB 16IEC len = Kbus Len +1, IECFrame lenth = IEC len + 6IEC FC calculate from : 4 to IECFrame Lenth -2
KBUS RX: 01 00 0A 61 |08 38 04 87 3C 2A 01 5D 68| DD E3
Loi busKitz 68 0B 0B 68 08 01 00 38 04 F1 17 06 00 5D 68 18 16
Arduino 68 0B 0B 68 08 01 00 38 04 EF 2B 0C 00 BA D0 F5 16KitZ 68 0B 0B 68 08 01 00 38 04 F4 0B 06 00 5D 68 0F 16Arduino 68 0B 0B 68 08 01 00 38 04 F1 0B 06 00 5D 68 0C 16
Gia tri nay thay doi ngau nhien
Gia tri Kbus + 3