取消
显示结果 
搜索替代 
您的意思是: 

convert an integer to 12 bit integer

 

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

0 项奖励
1 条消息(共 14 条)
13,430 次查看

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....

0 项奖励
2 条消息(共 14 条)
13,424 次查看

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

0 项奖励
3 条消息(共 14 条)
13,423 次查看

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. 😉

4 条消息(共 14 条)
13,411 次查看

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

0 项奖励
5 条消息(共 14 条)
13,392 次查看

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...

0 项奖励
6 条消息(共 14 条)
13,387 次查看

Yes. That's exactly what I am trying to do.

0 项奖励
7 条消息(共 14 条)
13,378 次查看

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:

 

  • An array of 12 booleans?
  • A binary formatted string of lenght 12 consisting of the letters 0 and 1?
  • An integer indicator set to such a binary display? (Do a bitwise AND with 4095 to ensure unwanted higher bits are blanked)
  • ...

 

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?

0 项奖励
8 条消息(共 14 条)
13,340 次查看

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.

 

Message Edited by altenbach on 10-07-2008 11:30 AM
0 项奖励
9 条消息(共 14 条)
13,322 次查看

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...

0 项奖励
10 条消息(共 14 条)
13,293 次查看