Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

writing modbus registers


benjammin Jan 24, 2012 10:05 PM

Hi,

I'm using:

ModBusMaster (EmonResult,ComSDC7,115200,1,3,Emon(),1001,38,3,50,2)

To read values from a modbus device.

However, there are four values i'd like to reset to zero... values/registers/whatever they are 1001/1003/1005/1007 and it only needs to be a one time thing...

I'm not really sure how to use the ModBusMaster command to do this, do I just use a 4 value array and set them all to zero?

Thanks!


benjammin Jan 27, 2012 05:05 PM

bump, no helps?


Karl Jan 30, 2012 08:53 PM

All you need to do is use another ModbusMaster instruction and use function 16 (write multiple registers). You will need to conditionally run the instruction unless you want to zero the registers all the time. An example would be:

ModBusMaster (EmonResult,ComSDC7,115200,1,16,Emon(),1001,4,3,50,2)

Make sure you set the valuse of Emon(1), Emon(2), Emon(3), and Emon(4) to 0 before you run the instruction.

Regards,

Log in or register to post/reply in the forum.