Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

A Checksum Algorithm

Status
Not open for further replies.

amindzo

Member
Hi,i want to connect two pic microcontrollers (PIC16F873A and PIC16F877A) with serial communication (with serin and serout instructions).there is a long distance between them (40 meter at least).i want to connect them with twist pair shield cable as a connecting cable. maybe we have some errors in transmission,which checksum Algorithm you suggest? what about CRC?
 
Last edited:
i will keep the data rate low but i want to use a A Checksum Algorithm to find and correcting errors. i used hamming codes before but it just correct one bit error, i think CRC is better,but it's more complicated.Is CRC suitable for my application? could you send me an article that explain CRC checksum algorithm?( i don't know how does it works and how does it correct errors?).
 
Last edited:
i will keep the data rate low but i want to use a A Checksum Algorithm to find and correcting errors. i used hamming codes before but it just correct one bit error, i think CRC is better,but it's more complicated.Is CRC suitable for my application? could you send me an article that explain CRC checksum algorithm?( i don't know how does it works and how does it correct errors?).i use picbasic pro and PIC16F87A.
 
Last edited:
i will keep the data rate low but i want to use a A Checksum Algorithm to find and correcting errors. i used hamming codes before but it just correct one bit error, i think CRC is better,but it's more complicated. Is CRC suitable for my application? could you send me an article that explain CRC checksum algorithm?( i don't know how does it works and how does it correct errors?).i use picbasic pro and PIC16F87A.
Have a look at Maxim's AN3969 App Note. The app note is about interfacing SD cards, but there's a good solid page on how to do CRC-7 and CRC-16. It's not difficult, and quite accurate. If there's an error, 99.9% of the time (probably better than that) it will detect it.

Write some code to send your data in packets. If you get a bad CRC on a packet you just resend it. Or if your data is small, just CRC the whole thing. If an error is detected, resend.
 
Last edited:
Keep in mind that there is a big difference between error detection algorithms and error correction algorithms.

I don't believe any of the CRC types can be used for error correction other then knowing there is an error and asking for a retransmission.

Hamming codes and Reed-Solomon I believe are both of the error correction type codes.

At least that is my memory, I'm sure a quick search on the web will tell you which communications check codes can be use for correction Vs just detection.

Lefty
 
If you are not already using them, you could improve the transmission quality in the first place by using max232 driver chips.

These are inexpensive and convert the 5V logic levels to +/- 7V RS232 levels which will work better over longer distance.
 
I've not used CRC but I normally add one checksum byte at the end of the data-packet, which is 2's complement sum of the all the bytes in the packet. At receiving end, the sum of all the bytes in the packet (including checksum byte) should be 0x00.

For example, if I'm sending 5 bytes/ packet, then add this 5 bytes without carry, then take 2's complement of the sum and attach it with the packet as 6th byte. At receiving end, add all the 6 bytes of the packet without carry, the sum should be 0x00. If the sum is not zero, ask for retransmission of the packet.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top