LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus TCP Slave API, how to tell a holding register has been read by a Master?

Solved!
Go to solution

I have a holding register as a 'new data flag'. The Modbus master reads this register every second to check if there is new data (Flag = 1), if so, it reads more (predefined) registers for the actual data. Once the data has been read, the Slave is supposed to reset the new data flag back to 0. However, I couldn't find an event handler in the Modbus API to enable such functionality. Anyone has ever run into a similar problem?

0 Kudos
Message 1 of 7
(529 Views)

You need to add one address in slave for acknowledgment of reading from master. Let us assume that you read 'new data flag' from address 0x100h. You can add additional address (0x101h) in slave for acknowledgment. Once the master reads the data from 'new data flag' from 0x100h, it should also write 1 in the acknowledgment register 0x101h. the salve just need to check the acknowledgment register 0x101h. Once it is 1 then it should consider that the master has read the data and then the slave should overwrite the data with 0 in 0x101h.


CLD Using LabVIEW since 2013
0 Kudos
Message 2 of 7
(513 Views)

Thank you for the suggestion. Unfortunately I can't dictate the Master's behavior. The Slave on this GC is able to detect the read action automatically, I am trying to implement something similar

 

https://www.agilent.com/cs/library/usermanuals/public/490-PRO%20Micro%20GC%20User%20Manual.pdf

0 Kudos
Message 3 of 7
(491 Views)
Solution
Accepted by topic author Bruce_NI_LabVIEW

Modbus is a rather old protocol designed to communicate with industrial devices (in origin, PLCs). It only features reads and writes.

Many companies tried to leverage this standard to implement new functionalities. For example in some cases you write into a register to trigger an action in the device. These are all nonstandard extensions that must be actively implemented in the slave loop. So, if your slave Modbus is open source you can add this new feature yourself, otherwise you have no chance.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019
0 Kudos
Message 4 of 7
(479 Views)

Understood, thank you. I am using LabVIEW Modbus library. Will try to find a more flexible solution.

0 Kudos
Message 5 of 7
(450 Views)

There are multiple LabVIEW Modbus libraries. At least one of them is open source, see here. I used it in some projects but not heavily.

This library is an example, not a product, so it's unsupported. I had to correct a bug myself when I used it the first time, about 15 years ago.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019
0 Kudos
Message 6 of 7
(435 Views)

Thank you for the additional info. Yes I was aware there are multiple libraries. What I meant was I am using the one that comes with LabVIEW installation (Part of DSC module I think). Sorry for the confusion. 

0 Kudos
Message 7 of 7
(431 Views)