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)...
Code:
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/
Bookmarks