Industrial Communications

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus RS485

I am attempting to work with a LeddarTech M16. The device communicates over RS485 using the Modbus protocol. I've wired the RS485 output on the device to a RS485-RS232 converter to a RS232-USB dongle. I am able to see the sensor in my Device Manager, and am able read data from the company provided software GUI. I would like to integrate this sensor with LabVIEW now.

 

The first step is that I want to send a function code, '0x11', and read the response. Per the sensor manual, I expect the response to follow:

 

ex

 

I've looked into this library, but am not sure where to begin. I can create a new Serial Modbus Master Instance, but I don't see how to send an object function code such as '0x11' and read the response. Any advice where to start? I've never worked with Modbus before.

 

 

0 Kudos
Message 1 of 11
(7,676 Views)

Hi pb3,

I think the Read Device Identification.vi if might be related with what you are looking for

 

modbusDeviceID.png 

That VI is intended to read information from the device as the one in your table.

 

Regards,

And G

NI

0 Kudos
Message 2 of 11
(7,641 Views)

Here is what I tried.

ex1.PNG

 

Received the following error message:

ex2.PNG

0 Kudos
Message 3 of 11
(7,613 Views)

Are you able to read/write regular Modbus registers? The error you are seeing seems to be related with some type of configuration on the serial connection (cable, baudrate, etc)

 

Regards,

And G

 

 

0 Kudos
Message 4 of 11
(7,599 Views)

Hi,

 

The interface reports a parity error. So ModBus communication cannot work at all.

Reason for the parity error is wrong parity setting (easy to check) or a bad RS-485 interface. 

Do you get a parity error on every try ??

 

Kees

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

Yes, every try

0 Kudos
Message 6 of 11
(7,534 Views)

Did you check the parity setting of your ModBus slave ?

0 Kudos
Message 7 of 11
(7,532 Views)

Yes, I'm using the specified parity settings. The RS485 line should be fine as the sensor works with the manufacturers software.

0 Kudos
Message 8 of 11
(7,530 Views)

So your device is using even parity ??

0 Kudos
Message 9 of 11
(7,526 Views)

It is even parity, but I can configure the device to be even, odd, none.

0 Kudos
Message 10 of 11
(7,509 Views)