PDA

View Full Version : Block Check on Serial Comms.



Mark Scotford
- 13th June 2005, 05:44
Newbie about to use Serial for 1st time (be gentle with me), I have to follow somebody else's protocol on a RS485 system. and they have specified that I use a Block Check at the end of the data string. They want "Even Parity Check (exclusive -OR)" is there anywhere I can find information on explaining to a non-maths person what this means, in simple terms?

Mark Scotford
- 14th June 2005, 22:42
Come on, help me out no replies yet, though lots of views, I asked this same question some time ago and the same thing happened. Is it a stupid question or is it unaswerable in its present form, please let me know?

Melanie
- 15th June 2005, 02:44
Probably just one of those obvious instances where everyone assumes that someone else is going to answer this one and nobody does...

You have a string of Data (in my example this is contained in an array DataP which is a block 16 characters deep)... You now EXCLUSIVE OR it all together to produce a CHECK BYTE (in the example we call the byte PARITYCHECK)...



CounterA var BYTE
DataP var BYTE [16]
ParityCheck var BYTE


ParityCheck=0
For CounterA=0 to 15
ParityCheck=ParityCheck^DataP(CounterA)
Next CounterA

In our above example, the ParityCheck byte contains the Exclusive OR sum of all the characters in the Block. When you transmit your Block, the ParityCheck Byte is the last character you send. This also goes by the name of LONGDITUDINAL PARITY.

Why is this used? By combining a Longditudinal Parity BYTE along with EVEN or ODD Frame Parity on each Byte, you can detect what Bit in a Block of Data has been corrupted and Error-Correct appropriately - which can't be done if you use EVEN or ODD Parity on it's own.

The logical EXCLUSIVE OR character ^ is fundamental in computing parity, you can look up it's use in the PBP manual.

When transmitting, set up your Serial Protocol for appropriate EVEN PARITY. Again check in your PBP manual for the Serial Command you are going to use (SEROUT, SEROUT2, DEBUG, HSEROUT) for details on setting up the number of Data Bits and Parity.

For more information, do an Internet Search... or try here as a starter...

http://home.apu.edu/~jcox/projects/individual/Vu/

Mark Scotford
- 15th June 2005, 08:54
Thanks Melanie, I'll marry you.

Melanie
- 15th June 2005, 09:27
*Smiles* Happily single and swinging... To qualify for the short-list, you'll have to email me a pic of proof that you're the proud owner of a really BIG...

...

...

...

Bank Statement (content - not paper size!) - now, what were you thinking I meant?

If you guys want to know the truth about us girls... from an internet search go dowload the cartoon movie lamour.asf (1.7Mb)... or try here...

http://www.ausgamers.com/files/details/html/793