LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to invert a byte ?

Solved!
Go to solution

What i want to do sounds simply so far but i can't find out a solution which can be that simple...

 

I have an array of byte for example : 1101 1010 and I'd like to invert it like this : 0101 1011

 

I did not find the VI to do this. I think it's not a Big/Little -endian issue. I have an idea about converting the byte in string and use the string revert VI. Then get back to byte but it's not optimised.

 

Have you got ideas ? 

 

Thanks for the help !

Message Edité par xela75 le 09-01-2009 06:56 AM
Message Edité par xela75 le 09-01-2009 06:57 AM
0 Kudos
Message 1 of 7
(7,095 Views)

It looks like you have an array of bits, however the easiest is to get a numeric representation of the byte (an U8) and use the boolean invert function.

 

Ton

Message Edited by TonP on 01-09-2009 02:01 PM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 7
(7,089 Views)

You propably want to XOR it with a bit-mask.

 

Felix 

0 Kudos
Message 3 of 7
(7,082 Views)
Solution
Accepted by topic author xela75

xela75,

 

It sounds like you want to reverse the bit order of a U8?  If so, try this.

 

 

Reverse Byte_BD.png

 

 

0 Kudos
Message 4 of 7
(7,064 Views)

Wayne.C,

 

It's weird that there is not a VI which does it...But your solution is interesting.

0 Kudos
Message 5 of 7
(7,049 Views)

Your solution is a good one !

 

Thank everybody for the help !

Message Edité par xela75 le 09-01-2009 07:56 AM
0 Kudos
Message 6 of 7
(7,041 Views)

Just for fun: (the hex constants are U64)

 

BitReverseByte.png

0 Kudos
Message 7 of 7
(6,994 Views)