05-16-2024 01:08 AM
I tired the circuit shown in first figure below using a for loop. It works well for well till the input is 511 as shown in second figure but when the number is increased above it, or iteration are increased it results incorrectly as shown in third figure
1.
2.
3.
05-16-2024 01:15 AM - edited 05-16-2024 01:41 AM
05-16-2024 01:52 AM
@altenbach wrote:
- You are not converting to binary, You still have a decimal number, but are only using the digits 0 and 1. That's not the same value as the input.
As a simple programming exercise, here's something similar that takes an integer and converts it to a decimal number that looks the same as the binary representation of the input. Seem silly!
There are many other ways to do that, though...
05-16-2024 01:54 AM
I attached my vi below , how should not be any orange anywhere
05-16-2024 06:26 AM
Tried the solution in LABVIEW 19.0 Version, but output is not as expected
05-16-2024 07:35 AM
Just another solution:
05-16-2024 09:01 AM - edited 05-16-2024 09:21 AM
@sasimitha wrote:
... how should not be any orange anywhere
Because you are dealing with integers exclusively. There are no fractional bits. Your lower shift register is I32 and after multiplying with 10 N times, you are hitting the ceiling.
05-16-2024 09:04 AM - edited 05-16-2024 09:17 AM
@sasimitha wrote:
Tried the solution in LABVIEW 19.0 Version, but output is not as expected
Obviously, you made a mistake but unless you attach your new VI attempt, we cannot help you troubleshoot. We cannot run your picture!
(Also note that I was using U64, not I64, but that should not make a difference. What is the datatype of the diagram constants?)
05-16-2024 09:37 AM
Note that even my solution will not work if the input is large, because even U64 can only have about 20 decimal digits or less, but you can have up to 64 bits in the input.
As long as you stay withing these limits, even this will work:
05-16-2024 09:53 AM
Do you want it as a number or as a string of 0's and 1's? If string, you can do like this: