tonzur40
asked on
MODBUS TCP PROJECT VB NET
After searching for days I found this project that communicate with an I/O module via Modbus TCP. The program works fine reading the inputs and displaying them on the the text boxes. The only problem is I have to click the button all the time to re-read the inputs I am wondering if anyody has ever use this project and can advice a way to keep reading the inputs constantly so the text boxes get update every time a change has been made, on the inputs.
http://www.codeproject.com/Tips/16260/Modbus-TCP-class?msg=5043651#xx5043651xx
http://www.codeproject.com/Tips/16260/Modbus-TCP-class?msg=5043651#xx5043651xx
use a timer to refresh instead of the button_onclick is one way
I also suggest using a timer to permanently re-read the Inputs.
In VB.NET you can create a timer as follows:
In VB.NET you can create a timer as follows:
Dim MyTimer as New Timer
MyTimer.Interval = 5000 'every 5 seconds
MyTimer.Enabled = True
AddHandler MyTimer.Tick, AddressOf MyTimerTick
Private Sub MyTimerTick (Byval sender as Object, Byval e as EventArgs)
' call your button_click to re-read the inputs
End Sub
ASKER
A timer was my first thought too but it is impractical when I want to trigger the request modbus event as soon as i have received the data from the IO module.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
A timer was my first thought too but it is impractical when I want to trigger the request modbus event as soon as i have received the data from the IO module.