CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

CRC code needed

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Kban
Guest







CRC code needed
PostPosted: Tue Jun 22, 2004 2:11 am     Reply with quote

Hi
I am looking for a CRC code that would run on CC5x compiler. I found some on this forum but since CC5x uses ansi C, and i am not too good at C anyway , it would be very nice if someone can provide me with code that would return CRC16 for a 20byte array, using simple if and for loops so that i can also understand whats happening.

Sorry if this is off topic due to other compiler

Thanks
Sigma



Joined: 03 May 2004
Posts: 48
Location: Sg

View user's profile Send private message

PostPosted: Tue Jun 22, 2004 4:01 am     Reply with quote

can refer to Ex_crc.c in the examples directory.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Jun 22, 2004 6:08 am     Reply with quote

Using Google you can find hundreds of CRC examples. You are not limited to searching a special version for your compiler since most examples are very short and easy to port.

Many people just choose an example code and copy this into their design and then months later they realise they have a problem: There is not just one CRC-16 method, but there are many!!! When you are communicating with your own applications you don't realize this as all your programs use the same software, but as soon as you want to communicate with someone else you have a problem.

Possible variations have to do with:
- Chosen CRC Polynome
- Initial value
- Reversed data bytes
- Reversed CRC value
- Use of an final XOR and value thereof

Resulting into more than 16 billion possible CRC-algorithms.....

One of the most wide spread CRC-16 algorithms is the CCITT implementation which has a CRC polynome of 0x1021 (x16 + x12 + x5 + 1) and a starting value of 0xFFFF.

Your best choise for compatibility is to search for keywords CCITT and CRC-16.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jun 22, 2004 12:28 pm     Reply with quote

If you want to search for CCS source code, do as I suggested
in a recent post. Search Google for exactly this string. It must
have the quotes, and the upper-case OR:

"#use delay" char crc OR crcc

Explanation:
The "#use delay" will find pages related to CCS, and the 'char'
helps to find actual source code. Then put your keywords on
the end, and separate multiple keywords with upper-case OR.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group