Author Topic: need to calculate CRC - CCITT  (Read 12720 times)

pixelfantastic

  • Newbie
  • Posts: 3
    • View Profile
need to calculate CRC - CCITT
« on: May 16, 2011, 11:25:53 AM »
hi,

i need to calculate a CCITT type crc checksum
...does anyone here know if its possible in Tbasic please?

(The C code is attached in case there are any maths geniuses here)
Thank you
Barrie


« Last Edit: May 16, 2011, 11:26:31 AM by pixelfantastic »

garysdickinson

  • Hero Member
  • Posts: 502
  • Old PLC Coder
    • View Profile
Re:need to calculate CRC - CCITT
« Reply #1 on: May 16, 2011, 05:16:16 PM »
Short answer, yes.  TBASIC supports enough bit operators to allow you to write code equivalent to the C example. The TBASIC version will be a bit less eloquent then the C version.

The is some built-in support for calculating CRCs in TBASiC. I suspect that it uses the same feedback terms as the CRC16-CCITT

Unfortunately I'm away form my computers and can't give you an example.

Gary d

garysdickinson

  • Hero Member
  • Posts: 502
  • Old PLC Coder
    • View Profile
Re:need to calculate CRC - CCITT
« Reply #2 on: May 16, 2011, 05:32:27 PM »
Look at the TBASIC function, CRC16.  This will probably do the trick.

Gary d