07-23-2013 10:13 AM
Hi all, I don't have much experience in LabView. However I got assigned to this task where I have to convert it to normal number display from hexadecimal.
Can anyone please help me with this? I have been searching and trying all the methods I have found online are not working.
07-23-2013 10:22 AM
I don't see what you're talking about. The only string indicator I see in your VI is already set for normal display (right-click it and see for yourself, as well as the string constant you are concatenating into it).
Cameron
07-23-2013 10:31 AM
Hi, the received buffer is showing data in hexadecimal form. I wonder why..
07-23-2013 10:36 AM
Show us an example of what you are talking about (input, output).
Cameron
07-23-2013 10:52 AM
Alright. I'm doing this serial communication thing that I connect two computers together and use PC1 to send any numbers to PC2. PC2 will show waveforms of the values keyed in from PC1. Besides that PC2 is supposed to show in front panel the same values sent from PC1. However, the result I got was in hexadecimal.
Eg. PC1 send "12"....PC2 display in received buffer "0x0C".
07-23-2013 10:54 AM
@teohcheesoon wrote:
Hi, the received buffer is showing data in hexadecimal form. I wonder why..
You need to be very careful how you word stuff with this stuff. "Showing data in Hexadecimal form" can be taken in a million different ways. Please give us an example of exactly what you have and exactly what you want. This is best done by making a VI with your input data as a control and your desired output as an indicator. Save all values as default and post this VI. It is best to get a bunch of data from your device and store that data in its raw form as well so we know exactly what you are starting with.
07-23-2013 10:58 AM
@teohcheesoon wrote:Eg. PC1 send "12"....PC2 display in received buffer "0x0C".
Well, 0x0C = 0d12. So the other computer must be sending the values in raw binary. It doesn't send '1' '2', it sends a binary value of 12, which according to my ASCII table is a New Page. So your code is doing exactly what you told it to. It is formatting the value into a string of the binary value in hex. So where is your problem? What should it show?
07-23-2013 11:04 AM - edited 07-23-2013 11:05 AM
Your indicator is doing exactly what you are telling it to: displaying the concatenated string (made up of 4 strings) "<nothing>0x<string from 'Number to Hexadecimal String VI'<CR/LF>", which gives you "0x0C<CR/LF>". If you had used 'Number to Decimal String VI' you would have gotten "0x12<CR/LF>". What are you really trying to get in your output? (And, why do you start this off with an empty string? It just makes things look a little more complicated.)
Cameron
07-23-2013 12:53 PM
As others have said, it is not clear what you want. If you want a different display, just change the formatting.
(There are also some race conditions and unecessary or weird code. Clearing of the chart history executes in parallel to the while loop, and whatever executes last wins. In this case the code might drop the first point from the chart. Remove the "insert into array" and use the build array to append the scalar ro the existing array. Don't overcomplicate things. You can wire the string directly to the case structure. Runnig a slow value change event off a slider is just asking for trouble...delay in a inner FOR loop!! You can eliminate the hidde "databuffer" by placing it in a shift register of the outer loop. Why is the string not wired across the other case? ...)
07-23-2013 12:58 PM - edited 07-23-2013 12:59 PM
@teohcheesoon wrote:
Hi, the received buffer is showing data in hexadecimal form. I wonder why..
Because you are using the Number To Hexadecimal String Function. What else do you expect?? 😮