PDA

View Full Version : Data verification



Daniel Simões
- 25th August 2006, 18:07
I am working with two PICs different in different frequencies (10 and 20 MHz).
My doubt if relates to the use of HSERIN and HSEROUT. The baud rate is 9600.
The first PIC1 read seven sensors/potentiometers and send for the second PIC2, only three variables with eight bits. The second PIC2 will control an industrial DC motor.
In case of timeout, ok, stop the motor. Could be a broken wire. No problem here. The project is working.
These two pics are work fine. The motor control is OK and HSERIN/HSEROUT are OK
My problem is:
How to make the verification of the data sent?
In case that it occurs errors in the data, it will be able to cause an accident.
I do not know as to make or a verification or a automatic correction of the data sent.
The maximum time of delay will not be able to exceed 1,5mS
Do you can help me? Thanks,

Daniel

DynamoBen
- 25th August 2006, 20:53
Search the forum/internet for information about CRC. That will provide you with error notification within each packet.

Daniel Simões
- 25th August 2006, 23:38
I looked for CRC and I did not find nothing. What it is CRC?

DynamoBen
- 25th August 2006, 23:47
Cyclic redundancy check

or

CheckSum

http://en.wikipedia.org/wiki/Cyclic_redundancy_check

Daniel Simões
- 26th August 2006, 00:41
Hi DynamoBen,

Ok, but how make it in picbasic pro?
I send three variables with eight bits (byte) each, for another pic.
I don't know how to implement it.
Thanks, Daniel

DynamoBen
- 26th August 2006, 03:59
What you are asking is very general, I'm not sure what would work best for your application. You will have to choose a method that works for you. The best I can do is suggest things that might work, you will have to sort through the details or each option. If you have specific questions about a specific method we should be able to help you out.

Have you searched the forums and read through other discussions on this topic? If so that should give you a start. Below are some threads that might help spark some ideas.

http://www.picbasic.co.uk/forum/search.php?searchid=146892&pp=25

http://www.picbasic.co.uk/forum/showthread.php?t=4494&highlight=checksum

http://www.picbasic.co.uk/forum/showthread.php?t=1413&highlight=checksum

http://www.picbasic.co.uk/forum/showthread.php?t=136&highlight=checksum

http://www.picbasic.co.uk/forum/showthread.php?t=833&highlight=checksum