10-07-2008 01:50 AM
Good Morning,
I know that is easy to convert an integer to 8 or 16 bit integer using the "number to boolean array" function.However, I would like to convert an integer to a 12 bit integer. Could you please advise.
Thank you in advance
10-07-2008 02:08 AM
Hello... 🙂
Can you please explain why you want 12 bit integer instead of 8 or 16...? Because according to me if you use 12 bit integer you will be able to use upto 4095 no. only....
10-07-2008 02:10 AM
Hi!
I'm sorry for answering a question with another question, but... why do you want to do this? Are you addressing a microcontroller? an ADC or DAC? Are you working with a DAQ board with 12 bits precision? Are you going to emulate fixed precision math calculation? If you let us know this,it'll be easyer to help you!
LabView for PC works on bytes, and I think you have to consider 12 bit integers as a mask of 16 bit integers.
graziano
10-07-2008 02:43 AM
thorfano wrote:I know that is easy to convert an integer to 8 or 16 bit integer using the "number to boolean array" function.However, I would like to convert an integer to a 12 bit integer. Could you please advise.
Sorry, but "number to boolean array" does not convert an integer to an integer, but to an array of booleans. That is something completely different!.
If you only want an array of 12 elements, start with a 16bit (or larger) integer and then user "array subset" to trim to 12 elements.
If you need something else, please be a bit more specific. 😉
10-07-2008 03:00 AM
Thank you all. Sorry for my poor explaination. I am using an NI USB-6212 OEM which will cooperate with another electronic circuit-card. What I really want to do is reading a digital word composed of 12 digits. Unfortunately, the available lines in the NI card is only 12, all other lines are occupied from something else. Thus, I can't start with a 16bit (or larger) integer and then use the"array subset" to trim to 12 elements, as altenbach proposed.
I am waiting for your support
10-07-2008 03:08 AM
If I'm not wrong you want to convert a no. into 12 bit.. Like 234 is the no. Then it should be converted like 000011101010....
Is it like so...? Please make correct if I'm wrong...
10-07-2008 03:19 AM
Yes. That's exactly what I am trying to do.
10-07-2008 10:27 AM
thorfano wrote:Yes. That's exactly what I am trying to do.
Since this was a long thread, could you tell us what exactly you refer to by "That's"? 😉
It is really not clear at all. LabVIEW does not have a native 12 bit datatype.
We still don't know what you actually want:
What kind of data do you get from the USB device? Can you make a small sample VI that contains your raw data as a diagram constant?
10-07-2008 01:29 PM - edited 10-07-2008 01:30 PM
altenbach wrote:It is really not clear at all. LabVIEW does not have a native 12 bit datatype.
Actually, let me take this statement back. 🙂 In newer versions of LabVIEW you can configure FXP data to be exactly 12 bit itegers.
10-08-2008 12:09 AM
Hello... 🙂
I have done a VI it's a bit lengthy.. But hope it helps you... 🙂
Atleast you will get an idea... 🙂
The VI is in LabVIEW 7.1...