LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Modbus TPC

HI.

I'm working on a LabVIEW small project. What I do now is trying to config LabVIEW as a Modbus TCP Master. However I have not received the Modbus slave yet, so I try to use a simulator software instead.

I config my PC's IP: 192.168.2.3 (same as address string in the "Creat TCP Master VI" block).

Port is 502.

Write starting address is 0

Write values are temperature and pressure

Read starting address is 5 (for example)

Read count is 1

Read values to a variable named "control signal"

I used the modbus simulator soft below

But the problem is: the values write from LabVIEW (temperature and pressure) are written to address 40001 and 40002. But the "control signal" is taken from 40006. I thought it has to be 30006. Right?

I tried another simulator soft (the last pic) but both write and read didn't work.

(Sometime it's error 538181, sometime error 56)

Could you suggest me the solution?

Thank you.

 

 

 

 

 

Download All
0 Kudos
Message 1 of 3
(1,745 Views)

A register beginning with a 3 is an input register.   You can only read from the slave.  You use modbus command code 4 "Read Input Register to get the value".

A register beginning with a 4 is a holding register.  You can read or write to the slave.  You use modbus command code 3 to "Read Holding Register", command code 6 to "Write Single Register", or 16 to "Write Multiple Registers".

 

Note that the 3 or 4 that is part of the register address is never transmitted.  And that the registers beginning 3 or 4 always start at 1,  while the protocol messages start at 0.

 

So 30006 is read using Read Input Register, and the value is 5.

 

Since you are using a subVI that is Write and Read Multiple Registers, it must be a Holding Register and is thus 40006.

 

You need to use Read Input registers with a 5, to read register 30005.  You can't write to it.  You need to do something on the slave side or the slave simulator to enter a value there.

Message 2 of 3
(1,734 Views)

Oh right. I see it. Thank you so much for your specification.

 

0 Kudos
Message 3 of 3
(1,726 Views)