LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

bit manipulation

Hey everyone,
I am trying to use labview to make my own bitmap files but I need to be
able to control values of BIT of information. Does anyone know what datatype
I need to see the value of every BIT?

Many thanks in advance,
--FRH
0 Kudos
Message 1 of 4
(3,890 Views)
I did something similar when I was checking the difference between two
bitmaps by comparing then pixel by pixel. You have to know the size of
the bitmap as well as the amount of color in the bitmap. The pixels
come out as an array, and to decipher the array, you need the number of
colors. I displayed the array as binary. Therefore, if I had a 1-color
bitmap, every bit is a pixel. If I had a 4-bit image, every 4 bits is a
pixel, and so on.

Mark

In article <39ac0f18@newsgroups.ni.com>,
"FRH" wrote:
>
> Hey everyone,
> I am trying to use labview to make my own bitmap files but I need
to be
> able to control values of BIT of information. Does anyone know what
datatype
> I need to see the value of every BIT?
>
> Many thank
s in advance,
> --FRH
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 2 of 4
(3,890 Views)
FRH wrote in message
news:39ac0f18@newsgroups.ni.com...
>
> Hey everyone,
> I am trying to use labview to make my own bitmap files but I need to be
> able to control values of BIT of information. Does anyone know what
datatype
> I need to see the value of every BIT?

You can convert a number to a Boolean array, in which each element
represents one bit, and you can convert a Boolean array to a number, so you
can manipulate in both directions. The individual Boolean is the closest to
what you'd call a "bit" datatype. The functions are in the "Boolean" section
of the standard function palette. A more detailed response needs a more
detailed question.

As a matter of curiosity to anyone else reading this, a single 32 bit wide
memory access c
an return a U32 for a given operation. If that U32 is
converted to a Boolean array, does it then require 32 memory accesses to
perform the same operation on it?
0 Kudos
Message 3 of 4
(3,890 Views)
> You can convert a number to a Boolean array, in which each element
> represents one bit, and you can convert a Boolean array to a number, so you
> can manipulate in both directions. The individual Boolean is the closest to
> what you'd call a "bit" datatype. The functions are in the "Boolean" section
> of the standard function palette. A more detailed response needs a more
> detailed question.
>
> As a matter of curiosity to anyone else reading this, a single 32 bit wide
> memory access can return a U32 for a given operation. If that U32 is
> converted to a Boolean array, does it then require 32 memory accesses to
> perform the same operation on it?

This approach will work quite well, but anothr approach is to simply leave
the data in numerics and AND/OR o
r with whatever bit pattern you are trying
to manipulate. This may seem more complicated, but it will end up using less
memory and take less time, if that is important. Also, lots of people don't
know that the Boolean operations will also work on integers, N bits at a time.

To answer the next question, a 32 bit number will be converted into 32 Booleans.
In LV5 and greater, that will be stored in 32 bytes. If you need to
copy the
Boolean array, then that will happen multiple element at a time, but most
logical operations will happen one byte, one Boolean at a time. When converted
back into a numeric, 32 adjacent Booleans will be recombined to form a number.
Less bits for different numeric types.

The Boolean arrays before LV5 were actually packed together into words, taking
less memory, but more processing to manipulate.

Greg McKaskle
0 Kudos
Message 4 of 4
(3,890 Views)