LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to write or read to a device that has a register address? See detail below and attached code.

Solved!
Go to solution

Assume a 8-bit device and its register address is 10, baud rate of 9600, communication protocol is RS-232 and I want to send a command in Binary or HEX to extract some data. Do you think VISA is the right tool to achieve that? If it is, how do I set up my command so that it can achieve what I am describing above? or Is there any other data communication tool that can help me achieve what I want to achieve? Please let me know.

 

With the code attached, my main problem is I am not sure where to put the register address of the  device, also how to send binary or Hex using VISA.

 

GRCK5000_0-1717075281252.png

 

 

0 Kudos
Message 1 of 5
(1,285 Views)
Solution
Accepted by topic author GRCK5000

Hi GRCK,

 


@GRCK5000 wrote:

Assume a device … baud rate of 9600, communication protocol is RS-232 and I want to send a command in Binary or HEX to extract some data. Do you think VISA is the right tool to achieve that?


According to your description of the communication port VISA should be fine to talk with your device…

 


@GRCK5000 wrote:

Assume a 8-bit device


What is a "8-bit device"?

 


@GRCK5000 wrote:

If it is, how do I set up my command so that it can achieve what I am describing above?


Read the manual of your device and communicate with it as described in that manual!

 


@GRCK5000 wrote:

With the code attached, my main problem is I am not sure where to put the register address of the  device, also how to send binary or Hex using VISA.


Just because there are "memory access" functions for some very special hardware supported by NI doesn't mean you can use those functions as "generic purpose for any kind of obscure hardware"!

 

Again: read the manual of your device. Then watch this video

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(1,264 Views)
Solution
Accepted by topic author GRCK5000

Hi 

Yes Visa is the right tool to do what you want. 

 

In order to write in Hex, you can right click on top of the string indicator you are going to read/write and select HEX display

 

you need to know the proper command access the register you want. The documentation of the device will have the communication protocol. 

 

LVNinja_0-1717077223894.png

 

Message 3 of 5
(1,263 Views)
Solution
Accepted by topic author GRCK5000

@GRCK5000 wrote:

Assume a 8-bit device and its register address is 10, baud rate of 9600, communication protocol is RS-232 and I want to send a command in Binary or HEX to extract some data. Do you think VISA is the right tool to achieve that? If it is, how do I set up my command so that it can achieve what I am describing above? or Is there any other data communication tool that can help me achieve what I want to achieve? Please let me know.

 

With the code attached, my main problem is I am not sure where to put the register address of the  device, also how to send binary or Hex using VISA.

 

 

 

 


What exactly is the device you are attempting to communicating with?

 

Because needing a register address makes me think this is using MODBUS protocol.

 

There is a full featured MODBUS Library for LabVIEW available through VIPM that simplifies reading and writing MODBUS registers.

========================
=== Engineer Ambiguously ===
========================
Message 4 of 5
(1,248 Views)

Thank you all for your answers!!! They are all helpful.

0 Kudos
Message 5 of 5
(1,176 Views)