# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Sending a hexadecimal command through Modbus Ethernet

I want to use the Modbus Ethernet Master Query Write function to send a hexadecimal command over ethernet. My problem is that the registers are numeric u16 and thus won't accept letters, but my command contains letters. As a hex my command is 4B 52 44 47 3F 20 30 0D 0A, so each pair is in one register, so I need to be able write a mixed number and letter in some of the registers. Is there a way to do this?

Message 1 of 7
(221 Views)

## Re: Sending a hexadecimal command through Modbus Ethernet

You could write

19282 = 0x4B52

17479 = 0x4447

16160 = 0x3F20

12301 = 0x300D

2560 = 0x0A00

to 5 U16 registers.

Regards, Jens

Kudos are welcome...
Message 2 of 7
(201 Views)
Solution
Accepted by topic author Nadweb

## Re: Sending a hexadecimal command through Modbus Ethernet

Make your control or constant show the radix.  Set it to be Hex display.  Now you can type those hex values in using 0-9,A-F.

Message 3 of 7
(180 Views)

## Re: Sending a hexadecimal command through Modbus Ethernet

As a hex my command is 4B 52 44 47 3F 20 30 0D 0A, so each pair is in one register, so I need to be able write a mixed number and letter in some of the registers. Is there a way to do this?

You can also use a string constant like this:

Are you sure it's a "hex command for Modbus"?

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 4 of 7
(171 Views)

## Re: Sending a hexadecimal command through Modbus Ethernet

I guess its a string serial command, KRDG? 0\r\n, that I have converted to hex for use with modbus tcp/ip

Message 5 of 7
(154 Views)

## Re: Sending a hexadecimal command through Modbus Ethernet

Modbus TCP/IP does not have any "commands" that look like that.

Perhaps you mean just TCP/IP communications with an instrument.  But it is not Modbus.

You can find details about Modbus communication here.  https://modbus.org/tech.php

Message 6 of 7
(151 Views)

## Re: Sending a hexadecimal command through Modbus Ethernet

It is an instrument specific RS232 command that I would normally send as a string using VISA write, so I was incorrect calling it a Modbus command. My understanding from the application engineer is that I can convert this command to a hex, and send it via Modbus TCP/IP Ethernet to our programmable automation controller, which should be able to send this to the instrument and read the response, via a boot program. I am very new to Modbus, so I'm learning as I go.

Message 7 of 7
(146 Views)