LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write a 3 bit number

hi.

This is really easy. I need to input a 3 bit number into a vi. For example, I want to input the number 3, and I need the program to write it as 003. or 78, and have the program show it throu an indicator as 078. how exactly cand we do that?

0 Kudos
Message 1 of 17
(4,054 Views)

Use a string control instead of a number control, then convert it.

0 Kudos
Message 2 of 17
(4,049 Views)

First, you should show what you have tried up till now.

Second, how does '78' connect to '003'?

Third: getting from 3 => 003, you can select the properties dialog (context menu), switch to "Display Format", select "Minimum Field Width" and set this to three. Choose to prepend '0' (Pad with zeros on left)

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 3 of 17
(4,048 Views)

Hi Anarki,

 

3 bit numbers usually are in the range of 0 to 7 (included). What kind of "3 bit number" is 78?

 

When you're talking about digits instead you can

- change the formatting of numeric displays to show 3 digits with leading zeros

- format your numbers into strings using a format string like "%03d"...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 17
(4,047 Views)

ok

what i mean by 3 bit number is a number made up of 3 figures. for example 999 is a 3 bit number. 1000 is a 4 bit number. sorry if i am not expressing myself correctly

0 Kudos
Message 5 of 17
(4,039 Views)

The term is, as Gerd already said: DIGIT(s) 🙂

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 6 of 17
(4,033 Views)

@Norbert_B wrote:

The term is, as Gerd already said: DIGIT(s) 🙂

 

Norbert 


 

A KL-10

 

 

may have been one of the last machines designed by EE's without a lot of input from the software developers. It had the most robust instruction set I have ever used. It had machine code instructions that could solve hyperbolic functions in a sinlge instruction. It served as the hardware where VAXes where emulated in software prior to VMS becoming a reality. Vaxes where predicessors to Pentiums and VMS preceed Window NT (VMS ---> V+1 =W, M+1=N, S+1=T WNT).

 

The backplane of that machine looked like this

 

 

thos blue wires were the clock signals and required adjustments occationally to keep them all in sync.

 

Since memory was still tiny little ferite beads back then it was very expensive so the KL-10 hardware implemented variable lenght data fields so you could actually pack 12, 3-bit numbers into a single 36 bit memory location.

 

 

I know this does not answer the orignal question but it was too geeky for me to resist.

 

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 17
(4,014 Views)

right, so I've done it. however it doesn't help me. I need to take every digit out of the number and apply a mathematical function to it. for example, if the number is 078 i need something like 0*5+7*9+8*3. or for 003 i need 0*5+0*9+3*3.

I've - changed the formatting to show 3 digits with leading zeros, but the program still recognises them as one number. what is to be done?

0 Kudos
Message 8 of 17
(4,012 Views)

Hi anarki,

 

it's always nice to see someone can't explain what he really wants in the first place...

 

Use some modulo functions (aka Quotient&Remainder) to get the single digits from your number. Quite elementary math...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 17
(4,009 Views)

the math above is just an example. its much more complicated, but still, just math:). the program itself is alot more complicated, this was the part I didn't get though so.. I just asked:d

 

0 Kudos
Message 10 of 17
(4,001 Views)