Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Read octet with value up to 127 Lire octet avec valeur ASCII supérieur à 7F (127 déc)

Solved!
Go to solution

Bonjour,

 

Je dois lire un octet d'une valeur supérieur à 127, Labview me retourne 27.

 

Dans l'aide j'ai vus que Labview ne donne une description ASCII que pour des valeurs allant jusqu'à 127.

 

Comment doisje m'y prendre ?

 

Labview 6.1

Windows XP

 

Hello,

 

I want read an byte  with a value up to 127, but Labiew reurn a value arround 27

 

How I must do ?

ASCII.gif

0 Kudos
Message 1 of 11
(5,145 Views)

Rather than the loop you can use the String to Byte Array function. That returns a U8 array, but you can use the To Byte Integer conversion function (To I8) to get an I8 array.

 

As for the values themselves, I would suggest placing an indicator on the string and setting the string to show in hex display mode. At least you can see if you have the correct string. 

0 Kudos
Message 2 of 11
(5,129 Views)

Thank for your help. I do change lyke I understood (my english is quiet poor...)

 

I have an other programme who comunicate with the instrument. I know that the 6° byte must be higher than 18 (upper than 7F in fact).

 

But with Labview I have only 18.

 

Diag.gifPanel.gif

0 Kudos
Message 3 of 11
(5,124 Views)

More clearly.

 

The other programme do a calculation and show only the result obtain with the 6° byte.

 

So I don't no the excat value of the byte, but I know the calculation, and so I know that this byte it'is more heigher than 18 (maybe FF).

0 Kudos
Message 4 of 11
(5,122 Views)
Solution
Accepted by topic author Rigide

Rigide wrote:

Thank for your help. I do change lyke I understood (my english is quiet poor...)

 

I have an other programme who comunicate with the instrument. I know that the 6° byte must be higher than 18 (upper than 7F in fact).

 

But with Labview I have only 18.


While it might be higher than x18, an I8 is signed, and therefore it cannot be higher than x7F - it has a range of -128 to 127. A U8 is unsigned and therefore it has a range of 0 to xFF. However, x18 is the same value whether you treat it as signed or unsigned. I don't see how LabVIEW could be reading a wrong value over the serial port. Are you sure you are looking at the correct byte? Your code shows that you are splitting the string twice. Are you sure you are doing that correctly? 

 

Since you are running on Windows you can double-check the received string by using PortMon. This allows you to see what is actually being received by the serial port driver of Windows.

 

P.S. I was actually referring to the To Byte Integer function.

Message 6 of 11
(5,107 Views)

Yes I'm sure to get the right part of the string : the first 5 bytes are OK, and the 7 last are too.

 

I will test PortMon tomorow.

0 Kudos
Message 7 of 11
(5,094 Views)

Here is what I get with Portmon :

 

Portmon.gif

 

 

What's mean error ring ?

 

 

 

0 Kudos
Message 8 of 11
(5,081 Views)
Those are just mask values for configuring the driver to notify the client when specific events occur. It's not actual data. The data that you would be reading on the serial port would be indicated in the IRP_MJ_READ lines. These should correspond to the bytes that come across the serial port, and they should match the byte values that you see in LabVIEW.
0 Kudos
Message 9 of 11
(5,067 Views)

Thank a lot for your help.

 

With Portmon I understood better what happens. So I think I have find what was wrong : some subtility if the value is greather than x7F

 

It seem I find it, I will confirm with the fabricant tomorrow.

 

Best regards

0 Kudos
Message 10 of 11
(5,061 Views)