Using the CRC calculator
kt88seamp
Posts: 112
I am creating my own program to transmit and receive data with the Parallax RF module. All I need is to add a CRC check (this is where I am in a snafu), and I can finish the rest. I downloaded and tried Beau's RF demo and it includes a CRC check. I am writing my own handshake algorithm. I looked at Beau's code and found working with the CRC object is a little tricky. For my code I need to know how to (see my program comments) using Beau's CRC:
Properly calculate and send the CRC.
Receive the CRC and validate it.
My program does successfully send data using straight RS-232. All I need to do now is packetize the data and implement the CRC and all should work fine.
Thanks,
kt88seamp [noparse]:)[/noparse]
Properly calculate and send the CRC.
Receive the CRC and validate it.
My program does successfully send data using straight RS-232. All I need to do now is packetize the data and implement the CRC and all should work fine.
Thanks,
kt88seamp [noparse]:)[/noparse]
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Signature space for rent!
Send $1 to CannibalRobotics.com.
Post Edited (CannibalRobotics) : 4/29/2010 9:51:35 PM GMT
http://forums.parallax.com/showthread.php?p=902959
Not all the code is there. Where is the portion that receives the data and validates the CRC?
This is the transmit peice - it sends a 16bit·CRC byte pair at the end of the packet, reversed and inverted. You don't have to go to that trouble - it's device specific.
The receive component would work similarly in that you would initialize the '_crc'·to $FFFF, cycle each new byte arrival through the updatecrc routine and when you have counted enough bytes - look to see if your calculated·CRC matches the transmitted CRC at the end of your arrived packet.
Let me know how it goes.
cheers
Jim-
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Signature space for rent!
Send $1 to CannibalRobotics.com.
Be careful on the byte count - it's easy to get it confused.
J-
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Signature space for rent!
Send $1 to CannibalRobotics.com.