10-06-2019 09:42 AM
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?
Solved! Go to Solution.
10-06-2019 10:00 AM
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.
10-06-2019 10:18 AM
Sorry forgot to say i need this on FPGA. So no string is available.
10-06-2019 12:36 PM
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):
01-04-2024 04:52 AM - edited 01-04-2024 04:54 AM
Divide the number with 10 until the quotient becomes zero. The reverse of remainder array will be the desired array of separate digit.
Hope that helps!
01-04-2024 10:28 AM - edited 01-04-2024 10:28 AM
Sorry Dharsen, but Altenbach's answer is 30-40 mSec faster than yours. And 5 years sooner too! 😁