kanber Posted November 4, 2009 Share Posted November 4, 2009 Hi, I am doing a modbus test program for twido CPU and IO moduls. I add digital and analog inputs channels device type "test", IO type "D to A". but digital and analog outputs I do with make modbus slave protokol and IOtype forcecoil and setregisterS16. everything is OK. but I write slave adres 1. but I want to change by a button or wtih edit box. all adress in channel list. is there any command or function for change modbus adres. Link to comment Share on other sites More sharing options...
AzeoTech Posted November 4, 2009 Share Posted November 4, 2009 Yes, you can do: mychannel.deviceNumber = newvalue and just repeat for each channel. If ALL channels need to be changed, you can use channel.listall() to get a list of all the channels, then loop through it, using the execute() statement to change each one: private string list = channel.listall() for (private i = 0, i < list.numrows(), i++) execute(list[i] + ".deviceNumber = newvalue") endfor channel.restart() You have to do channel.restart() after any changes to restart the timing loops, but do it after ALL the changes, not each one. Link to comment Share on other sites More sharing options...
kanber Posted November 5, 2009 Author Share Posted November 5, 2009 thank you. it is ok! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.