LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

HEX Problem

Solved!
Go to solution

Hi again,

 

I could really do with some help regarding sending commands using the code display string.

 

Basically i am need to send a HEX string of 02 08 00 xx xx 00 00 20 00 03 to a bluetooth device as a command.

 

The xx represent the changing data hex that i am sending.

 

The problem i am having is that i can send the command no problem by writing out a full string and using the \ code display input: \02\08\00\xx\xx\00\00\20\00\03 and this has the required effect.

 

When i send the same concatenated string i have issues.... 1st set \02\08\00 2nd set is my data 3rd set is \00\00\\20\00\03  but i dont get a code display output that i need, i get \02\b\009624\00\00\s\00\03

 

Im sorry if this doesnt make much sense but in my head i think it sounds ok!

 

Many thanks

 

Alex

 

 

0 Kudos
Message 1 of 29
(3,363 Views)

Since you are talking about commands in Hex, you should display your strings in Hex mode.  It will make reading the code a lot easier.


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
Message 2 of 29
(3,349 Views)

I'd like to see your actual code but you don't need all the slash characters.  The slash designates a non-viewable character so if enter \20 you'll end up with a space (ASCII 20d) which will the show as \s.  To enter "20 08 00" using codes display you would enter "20\s08\s00".  You're better off not using codes display since it only affects what you see, not the data that's sent.

 

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 3 of 29
(3,343 Views)

@crossrulz wrote:

Since you are talking about commands in Hex, you should display your strings in Hex mode.  It will make reading the code a lot easier.


I don't think hex mode display would help in this case.  It might be somewhat confusing since it displays spaces that aren't really there.

 

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 4 of 29
(3,340 Views)

You are sending exactly what you told the computer to send. If you consistently show your constants and indicators in hex, you'll see it right off. Displaying things in hex mode in LabVIEW always shows a space every two characters (4 bytes) to make it easier to keep your place, but a "space" character in hex is 0x20 (shows up as 20), so there's no chance of confusion. To me, the "\ codes" display is often more difficult to interpret, but sometimes necessary (i.e., if you're writing a regex).

 

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 5 of 29
(3,327 Views)

Hi,

 

Ok when i send the command as HEX i see 0208 0038 3832 3400 0020 0003   This as the output command

 

0208 00 is ok

00 0020 0003 also ok

38 3832 34 as my data to send is incorrect  im trying to send 8624 and it sends 3836 3234  instead (the ASCII version being converted to HEX i presume.)

 

Sorry if i am missing something simple here but im dammed if i can work it out.

 

Thanks again

0 Kudos
Message 6 of 29
(3,324 Views)

@kbbersch wrote:

@crossrulz wrote:

Since you are talking about commands in Hex, you should display your strings in Hex mode.  It will make reading the code a lot easier.


I don't think hex mode display would help in this case.  It might be somewhat confusing since it displays spaces that aren't really there.

 


Not really.  It just separates the data into 16 bit groupings, which makes it easier to read.  It is a lot more clear that the \ codes display.


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 29
(3,321 Views)

Don't use hex display or codes display.  Just use normal display.  The display does NOT change what is sent, only the way you see it.

 

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 8 of 29
(3,319 Views)

Hex display can be clearer if you need to see the hex values of the ASCII characters.  That's not what is needed here.  The OP needs to send ASCII HEX two characters at a time seperated by spaces, or at least that's what I'm readin and the way most instruments that I'm familiar with work.  Since that's what's needed NORMAL display will show what is being sent.  HEX disply will show the hex value of the ASCII characters being sent, which would be very conusing since what you see is nothing like what is being sent.

 

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 9 of 29
(3,312 Views)

Understood.

 

When i send a string in this view it shows in ascii characters, but i need to modify this string in each loop which is why i have been trying to see that i happening.

 

I find if i input the string with code display i have no issues sending the command.

 

Can i convert the HEX data i have to Ascii and then concatenate it into the string??

 

Thanks

 

Alex

0 Kudos
Message 10 of 29
(3,311 Views)