LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Number split in separate Digits

Solved!
Go to solution

Hi,

 

i have a Number like 156 this Integer i want split in integer 1, 5 and 6. How i can make this?

I need this number separate because i have three 7 Segments.

 

Somebody a idea?

0 Kudos
Message 1 of 6
(5,406 Views)
Solution
Accepted by topic author Saiz

Format into String and use each character individually using other string function in the palette.

 

Use quotient and remainder and divide by 10.  The remainder will be the units digit.

Repeat with the quotient in a loop to get the 10's digit, 100's digit.

0 Kudos
Message 2 of 6
(5,398 Views)

Sorry forgot to say i need this on FPGA. So no string is available.

0 Kudos
Message 3 of 6
(5,383 Views)

You probably need to do a few checks to make sure the number really fits into the number of digits so you don't display values that have little to do with the number. For example an input of 1000 should return 999, not 000. Of course there are other possibilities to handle it, but it needs to be handled unless you can guarantee that the input value never exceeds 3 decimal digits.

 

Here's one possibility (you can adapt it for FPGA):

 

GetDecimalDigits.png

Message 4 of 6
(5,348 Views)

Divide the number with 10 until the quotient becomes zero. The reverse of remainder array will be the desired array of separate digit.

Screenshot 2024-01-04 161333.png

 

Screenshot 2024-01-04 161342.png

 

 

 

 

 

 

Hope that helps!

0 Kudos
Message 5 of 6
(1,113 Views)

Sorry Dharsen, but Altenbach's answer is 30-40 mSec faster than yours.  And 5 years sooner too!  😁

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 6 of 6
(1,082 Views)