el 03-05-2017 06:23 PM
Que tal comunidad,
Soy estudiante de Ingeniería y estoy comenzando en el tema de programación en LabVIEW. Pues no soy muy experto. Así que les pido de su colaboración con un problema.
Adjunto hay un programa que convierte un número decimal y lo representa en hexadecimal, octal y en binario.
Mi problema está en que necesito mostrar cuántos bits, de mi arreglo de 8 bits, son necesarios para representar el número a convertir. Me explico con un ejemplo:
-Si el número a convertir es 8, en binario sería 0000 1000. Entonces debo mostrar un texto que lea "Se necesitan 4 bits para reprentar el número".
Estoy usando la versión de LabVIEW 2013 en Windows 10.
Muy amablemente me despido de ustedes y esperando que me puedan ayudar. Se agradece toda ayuda.
Walter
Estudiante de Ingeniería Electrónica
¡Resuelto! Ir a solución.
el 03-05-2017 06:53 PM
He aqui el programa guardado en la version 8.5
Mis disculpas
el 03-05-2017 09:02 PM
Buena noches. Suena a mí como usted necesita encontrar el número mínimo de dígitos binray necesarios para expresar un número entero. El español no es mi lengua materna y estoy usando google translate. Log2 (x) podría haberse perdido en la escuela, Logarithms confundir a muchas personas.
el 03-05-2017 10:26 PM
I speak English too.
So what I really need is as you inquired, the number of digits used to represent a binary number.
I was indeed thinking about a while loop that would divide the decimal number by 2 until the module reaches 1. And then get the number of iterations and that would be the amount of digits required to represent that number.
OK I already tried the while loop, but I can't get it to do the looped division it continues to take the same dividend. I attached my advance.
Hoping for your feedback
Walter
03-06-2017 01:13 AM - editado 03-06-2017 01:31 AM
For the loop, you need to learn about shift registers to operate on the result of the previous division. Currently, you are just repeating the same calculation forever.
A division by two is just a bit shift, so don't use anything orange. You can do it all in blue.
Two other possibilities: