CRC Calculator Routine


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: CRC Calculator Routine

    The highest bit of a polynomial is assumed to be 1, and is not included in the value used in the formula.
    It's presence in the polynomial indicates the length of the final CRC result.

    With x^8 + x^5 + x^4 + 1 ...
    The x^8 indicates that it is an 8-bit CRC, and it's bit position is not used.

    From there, you just stick the bits in a value to be used in the formula.
    Code:
        x^8 + x^5 + x^4 + 1
    
       7  6  5  4  3  2  1  0
      ------------------------  
       0  0  1  1  0  0  0  1
     ------------------------- 
     $          3           1
    The polynomial for plain CRC16 is x^16 + x^15 + x^2 + x^0
    So it's a 16-bit CRC, the x^16 is not used, and the poly value is $8005.
    Note that + x^0 is the same as + 1.

    The calculator you pointed to forces you to put the highest bit in the constant so it knows the length of the CRC.
    Otherwise, it's the same value ... $31.

    HTH
    DT

  2. #2
    Join Date
    Nov 2008
    Posts
    96


    Did you find this post helpful? Yes | No

    Default Re: CRC Calculator Routine

    Hi Darrel,

    I can now also confirm your CRC calculation code works well. Finally got back to my weather station receiver coding and added the CRC routines. No problems at all, works as advertised.

    Part of the delay was obtaining a bigger PIC to expand my code. Eventually got some PIC16F1509's.

    Regards,
    Martin

    PS. I saw your 'lost youth' sig message above. I think I did see your youth recently, but it was moving farther away from you at the time, and doesn't look like it's going to be coming back any time soon :P

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: CRC Calculator Routine

    Great!
    I'm glad it you got it working.

    And that's also great you saw my Youth. That means it's still around somewhere.
    Maybe I should offer a reward?


Similar Threads

  1. Dallas CRC8 Routines
    By Tom Estes in forum Code Examples
    Replies: 23
    Last Post: - 8th May 2018, 18:07
  2. Calculating CRC for Modbus RTU
    By tekart in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 20th January 2010, 22:42
  3. CRC Calculations
    By timmers in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 16th June 2009, 17:10
  4. Sensirion CRC
    By Tom Estes in forum Code Examples
    Replies: 3
    Last Post: - 9th November 2007, 15:09
  5. Problems with CRC8 Calc in 1Wire
    By JohnB in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 16th March 2007, 22:01

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts