LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus Response Issiues

Hey Guys,

I'm a mechanical engineer with no knowledge with LabView or Modbus.

For a project we need VegaDif 85 sensors. I have to get the data from these sensors wvia LabView.

So, with Modbus Poll yes I can get the data from sensor. You can see the values on the pictures.

 

 

 

But when I tried to implement on the LabView I have some problems.

I found video tutorials (link1, link2) and I got the VI and Block diagram from this video. You can see my block diagram on the pictures.

 

Labview BD.jpg

 

And this is the VI from video -because I forget the take a SS from my VI-

 

Labview VI.jpg

 

The problem I having is this: I dont get all the response message I only got this part: F603 0091 02

Can andbody help me with this specific problem? I couldn't figure it out where I'm doing wrong.

Thank you.....

0 Kudos
Message 1 of 4
(133 Views)

MODBUS uses registers not addresses, sure they are synonymous but proper nomenclature is important when explaining things.

 

You read a register to get data

You write a register to change settings 

 

Your device should have as "register map" that lists what registers hold what data and how to scale or convert that raw data to measurement values.

 

I'm not sure what flatten to string and all that conversion going on is all about...

 

What I did when working with a MODBUS device (three phase power analyzer) is create a sub-vi for getting the measurements I need. 

 

md0Capture.PNG

 

md1Capture.PNG

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 4
(114 Views)

Yeah I'm using that registers actually. 

For flatten to string youtube video say it is converting to modbus integer to string

Devolet_0-1768850871986.png

But yours is so simple. Is it possible to send it to me?

0 Kudos
Message 3 of 4
(104 Views)

The unit ID is probably wrong.

Your Modbus Response Indicator shows F603 0091 02, which means:

- F6 is the slave address, which is 246 in decimal.

- 03 is the function code, hard coded to 3

- 00 is the length of the received message: zero

- 9102 is the CRC value

 

The BD tries to reassemble the byte format of the message exchange, but it will only work if there are no errors. You could use NI I/O Trace to look at the messages that were sent and received.

 

That flatten to string is unnecessary. In this case it prepends the array length to the received data which is then removed through string subset.

 

You can just use type cast directly on the output from read holding registers.

 

typecast holding register output to singletypecast holding register output to single

 

0 Kudos
Message 4 of 4
(86 Views)