From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

set parity bit

hello everybody,
I would like to build an application in Lab 7.1 which is sending 16 bits (4 bits command, 11 bit DATA+1 bit parity), in fact I am finding a way to calculate te parity of my STRING, meaning if the number of one's are pair then the parity bit must be automaticaly set to '1', otherwise it stays ''0'' and then send all the 16 bits via SDI.

Does anybody have an idea how easily can be made?

Thanks in advance for support.

Benio
0 Kudos
Message 1 of 6
(3,825 Views)
Hi
There are different ways of calculating parity bit
Thi coul be one
Add 1 to sum of bits to invert parity
Hope it helps
Alipio
---------------------------------------------------------
"Qod natura non dat, Salmantica non praestat"
---------------------------------------------------------
Message 2 of 6
(3,806 Views)
The attached VI could give you a place to start.

Hope that this helps,
Bob
0 Kudos
Message 3 of 6
(3,801 Views)
Thank you alipio for the help, this give me an idea how it works with Labview and then I can implemet it in my application.
0 Kudos
Message 4 of 6
(3,791 Views)
Hi
Bear in mind that, probably, you will have to receive data, so the same vi should serve to calculate the parity bit of received data and, then, compare with the actual bit to detect errors.

Glad to be of help to you

Cheers
Alipio
---------------------------------------------------------
"Qod natura non dat, Salmantica non praestat"
---------------------------------------------------------
0 Kudos
Message 5 of 6
(3,784 Views)

I realize I'm very late to this discussion.

 

I found myself needing to determine parity on some U32s that are flooding thru my system. I saw the other 'convert to boolean, sum the TRUEs' VIs, and I thought there must be a way that is lower overhead.

 

I came up with precalculating a boolean array for 0x00 thru 0xFF, and then indexing that array by the byte value.

For U32 words, I use the one array, break the U32 into 4 bytes, and XOR the boolean outputs. TRUE = ODD parity on the output.

I do hope this helps someone along.

Download All
0 Kudos
Message 6 of 6
(3,227 Views)