LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert a string to a ten bit binary number?

For example we have a string (ASCII-format) that is 1A (two bytes and hexadecimal) that we want to convert to binary. Then we have another string that is for example 1B. This one we want to convert to binary and then pick out two of the bits and put together with the 8 bits we get from the first conversion. Then we have a ten bits binary number that we want to convert to a decimal number. Is this possible to do? Have anyone got a tip for us? 🙂 Thank you.
0 Kudos
Message 1 of 13
(2,940 Views)
Hello Ex-jobb,

just have a look at your older thread from yesterday...

Best regards,
GerdW
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 13
(2,931 Views)
Hello again!

Yes we tried that what you suggested but it doesn´t work. Maybe we are doing something wrong... can you please explain a bit more detailed if you got the time? Thank you for your help. Best regards!
0 Kudos
Message 3 of 13
(2,926 Views)
Hi there,

Is that what you're trying to do? Just don't get why ten bits ? and not sure if the end conversion is correct. Well check it out...
Cyril Bouton
Active LabVIEW Developper
Message 4 of 13
(2,927 Views)
Hello Cyril,

that's what I tried to explain. Nice example.

Best regards,
GerdW
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 13
(2,912 Views)
Hello again!

Thank you very mutch for your help! When we get the binary number from ex hex 1A it should be 00011010 but the VI you sent get the same number but from back (if you understand). Is there a way to get it from the other direction? We are quite new in LabVIEW so this might be en easy thing for you 🙂 Thanks for your help!
Best regards.
0 Kudos
Message 6 of 13
(2,911 Views)
GerdW!
So that was what you tried to explain 🙂 alright! It is harder to get what one mean when one don´t know so much about LabVIEW 🙂 Thank´s again!
0 Kudos
Message 7 of 13
(2,910 Views)
Hello Ex-Jobb,

you are trained to read a text from left to right 🙂
The bits are displayed beginning with bit number 0 because it's an array indicator. So you have to read from right to left to get the number from MSB to LSB...

For your other post: from time to time I have to train students for Labview. In my opinion it's better to tell the way and the student has to search the appropriate vi's because this way he/she learns faster where to find those vi's and how to use the Labview help functions... And I also think when I help someone to program than he/she has to think of an algorithm by itself and I only tell him/her how to get that algorithm running in Labview. (Otherwise I could do the programming by myself.)

Best regards,
GerdW
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 13
(2,906 Views)
Hello Ex-Jobb,

I forgot: you can use the "Reverse 1D array" function, but you have to take care of the proper display of your bits (perhaps restrict the display to 8 bits or adapt the number of displayed elements to the number of bits in runtime...)

Best regards,
GerdW
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 13
(2,905 Views)
GerdW!

Of course that´s how it is 🙂
0 Kudos
Message 10 of 13
(2,903 Views)