This is more a general question than something related to MODBUS in particular.
Since MODBUS won't send constant updates, you have to request them at regular interval to update your UI. For this, you have the options of:
- setting a page timer on the page that needs to display the status. Page timer will fire a command which is configured to execute a JavaScript function, which in turn requests a state update from MODBUS and uses the resulting values to update sliders, buttons, etc
that will call into your function to request state from MODBUS.
Once you get a status update, you'll receive values (typically, integers when you query registers). To fill a slider, you'll have to convert the value from its initial range to the range 0-65535 which is the range our sliders operate in.
For example, if the value you receive is in the range -100 to +100 and you want to assign it to slider a40, you'll do the following:
var sliderValue = Math.max(65535, (modbusValue + 100) * (65535.0 / 200.0));
CF.setJoin("a40", sliderValue);
Hope this helps,
Florent