LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion of whole numbers in their digital representation.

 Good, I would like to know how to convert a number between 0 and 10, in its 8-bit digital representation (using the algorithm of successive approximations and with loop for or while).

 

I attach an example image with 4 bits.

I hope you can help me.

0 Kudos
Message 1 of 5
(2,472 Views)

Hi Jose,

 

is this some kind of homework?

Did you get this task to learn LabVIEW?

 

You need a (FOR) loop, a shift register and some comparision function (as you already have learned here). I guess you can figure the needed algorithm on your own (or even got that from your teacher)!

When you want to cheat you could just use an integer indicator set to base 2 display mode…

 

Btw. for numbers between 0 and 10 you only need 4 bits.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(2,468 Views)

Yes, I know I have to use a displacer, a for and comparators, but my doubt would be how to use the comparators in this case.

0 Kudos
Message 3 of 5
(2,390 Views)

@jose_1819 wrote:

Yes, I know I have to use a displacer, a for and comparators, but my doubt would be how to use the comparators in this case.


Well, try a few things. You should be able to figure it out!

0 Kudos
Message 4 of 5
(2,387 Views)

To sum this up, here's a quick implementation for 8 bits. (Of course you could calculate the input constants based on N and i inside the loop)

 

SuccessiveApproximationK.png

0 Kudos
Message 5 of 5
(2,334 Views)