LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

normal string display to Hex string display

Hi all
i like to convert a normal strijng display which contains alphanumeric strings to hex format
String length will be of 25 characters which will be read through bar code reader
 
Could someone help me in solving this
 
Thanks
 
Bala
0 Kudos
Message 1 of 12
(4,595 Views)
I'm not sure I understand what you're asking. Do you want a hex number, or do you want the input string converted to a hex value, and then back to a hex format string, which just gets you back to where you started?

For example, if you have the string "A34B", well, that's already in hex "format".


Message Edited by smercurio_fc on 06-13-2008 09:35 AM
0 Kudos
Message 2 of 12
(4,584 Views)
Right click the indicator and select "Hex Display"
0 Kudos
Message 3 of 12
(4,573 Views)
You know, I though about suggesting this, but then I wasn't sure that's what the user wanted, since that would display the character "A" in its ASCII code, which would be hex 41. Still confused as to what the user wants.
0 Kudos
Message 4 of 12
(4,570 Views)
My best guess would be data comes in through the barcode scanner and he wants to transmit the hex values over a network or something?  maybe a third party dll?  in which case, a typecast to U8 and number to hex string or something like that would work
0 Kudos
Message 5 of 12
(4,564 Views)
Or he only wants to display the read string in hex... in which case he only needs to set the format of the indicator to Hex Display... still not shure...
0 Kudos
Message 6 of 12
(4,559 Views)

hi all thanks for your replies...

i will explain my problem again.

I am reading a value from a bar code reader in a string control (Labview) which is in Normal display property

value of a bar code reader for example will be AC0725470860003 - SD.

i need to transmit this via serial port to processor

this value i couldnt pass as it is because serial port converts A to its Ascii value 31 and so on..

but i need to transmit as Hex value i.e AC07... in my serial port. when you view in labview string indicator by changing its property to HEX display i should get this value not the ASCII value.

find the attached Snap shot for details

kindly revert me back

Thanks

0 Kudos
Message 7 of 12
(4,554 Views)
Yes, if you try to transmit the string you get from the barcode directly you're just transmitting the character "A", followed by the character "C", etc, as opposed to the hex value A, which corresponds to a linefeed character. In this case you need to convert the string to hex values. However, since you have a long string you will need to do it character by character. Your total string length exceeds a U64. Also, your "want" Hex display is wrong. "-", "S", and " " are not valid hex values. Something like the following should work:

Download All
0 Kudos
Message 8 of 12
(4,547 Views)
Hi smercurio_fc
 
Thanks for the vi. i tried the method which you have sent me.
 
So i cant transfer 'S' through serial port?
 
Is there any other way to transmit this through Serial port.
 
Also i need another clarification
 
A sub vi is running inside my main vi and i need to stop/pause the sub vi from the main vi front panel. how could i can stop the sub vi?
 
Thanks and regards
 
Bala
0 Kudos
Message 9 of 12
(4,536 Views)
I never said you can't transmit "S". All I said is that "S" (along with a space and the "-" character) is not a valid hex value. Individual hex values are 0 through 9 and A through F. The code I provided simply assumes you have a character that represents a hex value. You said you wanted to transmit "A" as the hex value A, not as the character "A". To do so you need to convert the character "A" to a hex value of A. You can use the TypeCast to get a string out of it. Since I was using a loop I used the Byte Array to String since I had the array right there.

How is "S" supposed to be transmitted? As "S", or as something else? If each character needs to be tested to see if it's a representation of a hex value then you need additional code. Or, is the hex value interpretation only supposed to happen until a certain character (like the space)?
0 Kudos
Message 10 of 12
(4,529 Views)