Modbus Tcp Sequence Issue


Munro

Recommended Posts

Hi,

I am reading date from a device its polling beautifully but far to often.

I am trying use the read() staement and the delay (readinterval), so that it only reads as I get new data on the channel, at present its reading continusily.

How can I correct this?

Look forward to your reply

while (1)

read(CW1A_Weight)

delay(1)

endwhile

Link to comment
Share on other sites

Hi,

No I want it read only when I get new data on the channel, I tried using the readinterval but am unsure how this works.

I will not run and throws up errors and the manual with respect I feel does not explain well how to get this working.

Look forward to your reply

Thanks

Link to comment
Share on other sites

So you want to read one channel only when you get new data on another channel? I'm unclear when you want to do the read. The script above will read that channel at a variable interval determined by the readinterval variable. To get it to work, you need to declare and define readinterval somewhere, for example:

global readInterval = 1

Link to comment
Share on other sites

Sorry, I'm still unclear what you mean by "new data arrives". You are using Modbus which is a poll / response protocol. This means that DAQFactory has to poll the device to get a new value. The device can't push a new value to DAQFactory when the value changes. If you just want to see the most recent reading of CW1A_Weight, set the timing of that channel to, say, 0.25, then create a variable value component and put:

CW1A_Weight[0]

for the Expression.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.