# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## How to reverse an order of an 8 bit value

Hi,

I want to produce an mirror value of an 8 bit numeric. suppose my value is 11101100, my output should be 00110111. how can i get this??

Message 1 of 14
(11,197 Views)
Solution
Accepted by topic author esaravanan85

## Re : How to reverse an order of an 8 bit value

Here is a solution.

Message 2 of 14
(11,191 Views)

## Re: How to reverse an order of an 8 bit value

Use Numeric->Data Manipulation -> Rotate
Message 3 of 14
(11,190 Views)

## Re: How to reverse an order of an 8 bit value

I'd solve it through a small for-loop, bitshift the incoming in one direction (e.g. left) through a shift register and build an outvalue by shifting in values (the output from the former shift) in the other direction (e.g. right).

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Message 4 of 14
(11,185 Views)

## Re : Re: How to reverse an order of an 8 bit value

Use Numeric->Data Manipulation -> Rotate

No, this will not produce the expected mirror !

Message 5 of 14
(11,178 Views)

## Re: How to reverse an order of an 8 bit value

My vi works. It has minor changes to the one posted above.

They're explained in the front panel.

Message Edited by ST5 on 03-23-2010 06:54 AM
Message 6 of 14
(11,138 Views)

## Re: Re : How to reverse an order of an 8 bit value

Thanks JB 🙂 i got my solution....
Message 7 of 14
(11,092 Views)

## Re: How to reverse an order of an 8 bit value

What we've learned from the bit twiddling challenge, doing the detour over the boolean array is not very efficient. If this is used on huge amounts of data in tight loops, it might be better to use a lookup table instead. Look ma, no green!!! 🙂

(Of course you would create the lookup table once using a FOR loop with N=256, and containing the above code.)

Message Edited by altenbach on 03-24-2010 12:19 AM
Message 8 of 14
(11,075 Views)

## Re: How to reverse an order of an 8 bit value

I still find my little loop suggestion fun. 😉

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Message 9 of 14
(11,043 Views)

## Re: How to reverse an order of an 8 bit value

Yamaeda wrote:

I still find my little loop suggestion fun. 😉

Very cute. That's probably the fastest you can do with explicit code.

Here are some benchmarks (5M U8 numbers, LabVIEW 8.0, debugging disabled).

Green (reverse boolean array): 385ms 10x slower

Yamaeda:                       272ms  7x slower

My Lookup table:                39ms     winner.

Clearly, the LUT wins hands down. 😉

Message 10 of 14
(11,013 Views)