LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert hexa to normal display in serial comm.

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.

Untitled.jpg 

0 Kudos
Message 1 of 10
(2,823 Views)

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

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 2 of 10
(2,817 Views)

Hi, the received buffer is showing data in hexadecimal form. I wonder why..

0 Kudos
Message 3 of 10
(2,808 Views)

Show us an example of what you are talking about (input, output).

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 4 of 10
(2,805 Views)

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".

 Untitled1.jpg

0 Kudos
Message 5 of 10
(2,801 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 10
(2,799 Views)

@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?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 10
(2,795 Views)

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

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 8 of 10
(2,793 Views)

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? ...)

 

 

0 Kudos
Message 9 of 10
(2,768 Views)

@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?? 😮

0 Kudos
Message 10 of 10
(2,765 Views)