Winmodbus master now contains a simple web server which allows you to view and change data from a browser or similar.
From the connection details [Setup/Comms parameters menu], you can set the port that the internal web server listens on. Setting this to 0 will disable the server.
If you set it to, say, 8000, you should be able to run up your browser and go to http://localhost:8000/ and see something like the following:
{
"app":"",
"connected":false,
"program":"WinModbus Master",
"running":false,
"version":"1.0.4.0"
}
All replies are in json.
Reading data
Reading data is done by first subscribing to a list of addresses and the calling update to get changes to those addresses.
Subscribe:
http://localhost:8000/subscribe?item[]=10&item[]=1000&item[]=1001&item[]=1002&item[]=1003&item[]=1004
This will return json as follows:
{
"link":false,
"values":[
]
}
Any subsequent subscribe will clear any existing subscribe list first.
Update:
http://localhost:8000/updates
This returns json containing link status and an array of change values, each an object with name (address) and new value:
{
"link":false,
values":[
{
"name":1000,
"value":"1"
}
]
}
Writing:
http://localhost:8000/ident?item:1000&value=123
Attempt to write a value to an address. In the above example, 123 will be written to address 1000 if it exists. The next call to update will reply with the new value against address 1000 if the write works (and address 1000 has been subscribed to)
Winmodbus Master contains an example html file with some internal javascript to show and update values. Clicking on a value will allow you change it.