LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview

Write a program to convert binary number to decimal number (Do not use the inbuilt
function in Labview. Use basic mathematical functions and loops).

0 Kudos
Message 1 of 6
(1,047 Views)

@rajkumar523 wrote:

Write a program to convert binary number to decimal number (Do not use the inbuilt
function in Labview. Use basic mathematical functions and loops).


Alright,  we won't do your homework but we can help with defining the steps.

 

  • You need to specify the datatype of the inputs and outputs (If your input is a numeric integer type no code is needed at all so, that would make no sense)
  • You need to define which exact functions are prohibited.  (Although it makes very little sense to me either yo Task someone to write code that is intentionally obfuscated)
  • What have you tried and where are you getting undesirable results (attach your vi or even a code snippet)

LabVIEW is an acronym.   This entire board is about LabVIEW.  The topic title "labview" provides us no guidance on what your needs might be.


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 6
(1,033 Views)

im new to labview , if 7u can help help me

0 Kudos
Message 3 of 6
(1,027 Views)

@rajkumar523 wrote:

im new to labview , if 7u can help help me


Sure I can help.  But I do need to know the datatype of the input.

 

For example; if the input is a string simply use String to byte array compare the byte array to 0d49 to output an array of boolean where "1" = TRUE. Reverse the array and use T/F to 0 1 from the conversion pallet.   Autoindex the reversed 0 1 array in a for loop with an U32 Shift Register initialized to 0. AND each element with the value on the Shift Register then wire the AND to an output tunnel set to Last value.  Also branch the AND output, Left Shift it and wire that to the Shift Register. Wire the output tunnel to an indicator. 

BONUS: Show the radix of the U32 indicator and toggle between decimal and binary to check your work.

 

There are about a thousand different ways to get the same result, even on a string input.  What have you tried?


"Should be" isn't "Is" -Jay
Message 4 of 6
(1,017 Views)

To get help, you need to define the problem.

 

What is a "binary number" (under the hood, everything in a computer is binary one way or another!)

 

  • A string containing the characters 0 or 1 exclusively. How long can it get?
  • An integer array where the elements are either 0 or 1?
  • A boolean array where each element represents a bit?
  • An integer (blue) datatype where you set the display to binary?
  • Is the LSB on the left or right?
  • Is the number guaranteed to be positive or can there be a sign bit?
  • If there are more than 8 bits, what is the byte order (little or big endian)?

 

What is a "decimal number"?

 

  • A string containing the characters 0..9 exclusively?
  • something else?

 

For easy testing and verification of the correctness, I would include code to convert a number to binary, then add your code to convert back  so you can test if the result is correct and matches the original value..

0 Kudos
Message 5 of 6
(983 Views)

Start with trying to implement the following in LabVIEW, then modify to improve to adapt to your actual input and output.

 

I intentionally did not label any of the functions or structures and let you figure it out. This should give you plenty of opportunities to learn. Start with a few basic tutorials and ask questions if you get stuck. there are plenty of learning resources listed at the top of the forum.

 

 

altenbach_0-1697905220602.png

 

 

0 Kudos
Message 6 of 6
(969 Views)