ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS422 write buffer, read data format

Hi, I intend to read a distance value from a laser sensor using an RS-422 to USB converter. I have used the serial read LabVIEW example, but I am not getting the expected result. I am unsure about the write buffer string in VISA Write, and the data extracted from VISA Read is not in a readable format. Please suggest

 

 

0 Kudos
Message 1 of 4
(427 Views)

Hi Parthiban,

 


@Parthiban_SM wrote:

I am unsure about the write buffer string in VISA Write,

and the data extracted from VISA Read is not in a readable format.

Please suggest


  • For the VISAWrite there is a clear description in the manual about the possible commands.
  • There also is a description how multi-byte results (especially the 18bit distance value) is provided by the device: 3 bytes with their lower 6 bits holding the measurement data. I don't see any code where you attempt to handle those lower 6 bits of each of the 3 bytes…
  • Yes, the data is provided in "unreadable" format: switch the string indicator to hex display!!!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(404 Views)

You have the right idea, trying to remove the first 2 bits from each byte, but it's not quite correct. Here is how to do it, note that you can apply boolean operators directly on integers:

Byte reconstruction.png

0 Kudos
Message 3 of 4
(385 Views)

Hi fuko,

 

is there a reason to answer with a crosspost from Reddit?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 4
(344 Views)