LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

string to number conversion- a very interesting observation

hello every1,
 
I am trying to use the basic serial readwrite.vi file. to get binary data into labview..what i do is right click on the string front panel and select hex display option .and when I run the program I get the data in hex display..but this does not mean that the data is converted in hex format...this came to my notice when I tried putting a probe in the block diagram..before the data went into a loop....it showed the unreadable binary format instead of hex format data..which meant that the data was not converted into hex format..now I need to get the data in decimal format how do i get that???any suggestions would be greatly appreciated?
 
-innovator81
0 Kudos
Message 1 of 32
(4,411 Views)
I think the only problem you have is that the normal probe does not do hex display - it just does normal display. If you create a custom probe, then it should look just like the data you've entered into the string control.
Message 2 of 32
(4,401 Views)

thanx for replying..well i am running this for loop for getting the hex string which is of the form xxxx xxxx xxxx xxxx into xxxxxxxxxxxxxxxx form..to remove the space after every 4 bytes...but whats happening is i am getting the same format even after running it in the for loop which has shift registers...so i went ahead and put the probe on the data going into the loop and it indicated that the data going into the loop was not hex data...

 

-innovator81

0 Kudos
Message 3 of 32
(4,390 Views)

To add to what Dennis said, from the computer's point of view, the number is not converted at all.  It is just a bunch of 1s and 0s.  Conversions are done for the user's convenience.  Whether a number is shown as hex, binary, or decimal makes no difference except for appearance.  Math functions will act the same on any display format.  Besides using a custom probe, you could put into your code a Number to String Conversion function with a string indicator if you want to always see the result in a particular format.  For hex, use the Number to Hex String function.

Post your code and we can help you better.

Message Edited by tbob on 02-07-2006 03:17 PM

- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 32
(4,391 Views)
What is your input to the shift register: charaters, the entire string, a number?  Post your code please.
- tbob

Inventor of the WORM Global
0 Kudos
Message 5 of 32
(4,386 Views)
I'm not sure what you're trying to do. Are you trying to get or receive hex from the serial port? If it's receiving hex, what do you want to do with it? You can use string to byte array to get an array of U8.
0 Kudos
Message 6 of 32
(4,383 Views)

hello every1,

Thanx for replying..i am attaching the file herewith...please go through it and let me know whats the solution

 

-innovator81

0 Kudos
Message 7 of 32
(4,380 Views)
For some strange reason, I can't open your attached vi.  I even tried to save it, then open it from my local drive.  No errors, no complaints, just the Labview splash screen appears, no front panel or block diagram.  Please try attaching it again.  Make sure you can open it with Labview first.
- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 32
(4,371 Views)
well its in labview 8 version...
0 Kudos
Message 9 of 32
(4,369 Views)
Sorry, don't have LV 8 yet.  Coming soon.  If you can, save for previous version (LV7.1) and post again.
- tbob

Inventor of the WORM Global
0 Kudos
Message 10 of 32
(4,360 Views)