LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CONFUSED WITH HEXADECIMAL FORMAT

Hello everyone,

I am trying to communicate with Varian Multi-Gauge via serial port. I have programming manual in front of me with syntax for all commands.
"The command structure is written in hexadecimal notation as indicated by the suffix H".(stated in manual)
Here are 3 examples of the command syntax as written in the table from the manual:

{01}
{03H}
{0AH} and so on.
Each of these three lines represent the actual command syntax.
Now can you please tell me what do I send to the Visa write?
Take for example {02H}. Do I take decimal string (eg. 02H) and concatenate it to the carriage return/line feed and then bring it to VISA write. Or I write "02" without H at the end or I convert 02H to hex and then ...or I convert 0
2 to hex and then...

Thanks for your help everybody,
Pedja

p.s. my VI is attached
0 Kudos
Message 1 of 6
(3,546 Views)
Coop wrote:

> I am trying to communicate with Varian Multi-Gauge via serial port. I
> have programming manual in front of me with syntax for all commands.
> "The command structure is written in hexadecimal notation as indicated
> by the suffix H".(stated in manual)
> Here are 3 examples of the command syntax as written in the table from
> the manual:
>
> {01}
> {03H}
> {0AH} and so on.
> Each of these three lines represent the actual command syntax.

There should be somewhere an explanation of the syntax. This could mean
a number of things.

1) send it as a string as printed including the curly braces.
2) send just the string inside the curly braces
3) send a single 8bit integer with the according value e.g. 1, 3, 10
4) as 3) but the braces indicate some form of
start of text character
(8bit integer) and end of text character
5) as 4) but after the end of text follows some sort of checksum as well

> Now can you please tell me what do I send to the Visa write?
> Take for example {02H}. Do I take decimal string (eg. 02H) and
> concatenate it to the carriage return/line feed and then bring it to
> VISA write. Or I write "02" without H at the end or I convert 02H to
> hex and then ...or I convert 02 to hex and then...

Your documentation really should tell you a little more. Maybe they have
some example in there in C, or even Basic would be fine. Look at that
and then try to understand what they do and experiment in LabVIEW until
you get some response.

If you can give some more information of what the programming
documentation says about this, we can look at it and try to come up with
a more detailed suggestion.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 6
(3,546 Views)
1) If I send the command including curly braces I get response invalid command so that is not the right way
2) I tried sending just string and that did not work
3) 4) and 5) I am not exactly clear how would I send the command in this form. Can you use {02H} example and explain what you mean.

The manual I have does not say anything more than what I told you and unfortunatelly there is no C or Basic example in it either. That would definitelly help.
I contacted the tech support for this device and this is reply:
"Using 02H in your program will probably work because it should know that it is hex".
All I know is that whatever I tried so far my response is "FF" which means invalid command.

I appreciate for help,
Pedja
0 Kudos
Message 3 of 6
(3,546 Views)
Coop wrote:
> 1) If I send the command including curly braces I get response invalid
> command so that is not the right way
> 2) I tried sending just string and that did not work
> 3) 4) and 5) I am not exactly clear how would I send the command in
> this form. Can you use {02H} example and explain what you mean.

Create a string control or constant. Right click and select "Hex
Display". Now enter 02 in the string. This will create a string with one
single character with the ASCII code 02H.

Alternatingly you can select "'\' Codes Display" instead in the right
click popup menu. Now enter \02 which is the same as above. Remeber
these Display modes only influence how LabVIEW shows the content of the
string to you. The contents of the string is n
ot affected at all by
switching between these Display modes.

Maybe this already works. If not try to add a 0D or 0A (Hex Display) or
\r or \n ('\' Codes Display) after the first character. The checksum
idea 5) was only an idea to show you that what your documentation
provides is VERY unspecified.

> The manual I have does not say anything more than what I told you and
> unfortunatelly there is no C or Basic example in it either. That would
> definitelly help.
> I contacted the tech support for this device and this is reply:
> "Using 02H in your program will probably work because it should know
> that it is hex".

Rubbish! Tell them you are using a real language and not Visual Basic or
something like that.

> All I know is that whatever I tried so far my response is "FF" which
> means invalid command.

What display mode are you using to show this "FF"?

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 4 of 6
(3,546 Views)
Hi Rolf,

I managed to make it work. I came to a decision to switch the control display to hex and then I typed the command in without H as a suffix and now I am reading values properly but in hex format. I posted new question asking how to convert this format into decimal format which is more convinient for diplay.

If you want to check my post it is still unanswered and the tittle is "convert hexadecimal output to decimal (number)".

Thanks for your time,
Pedja
0 Kudos
Message 5 of 6
(3,546 Views)
Coop wrote:

> If you want to check my post it is still unanswered and the tittle is
> "convert hexadecimal output to decimal (number)".

Answered in the meantime.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 6 of 6
(3,546 Views)