bramoosterhuis / simple-modbus

Automatically exported from code.google.com/p/simple-modbus
0 stars 0 forks source link

Support for function 5 and 6. #33

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. The modbus slave I have does not support function 16 for setting register, 
only function 6.
2. Same goes for function 15, not supported, only function 5.

This is a thermostat from Delta automation.
Reading registers and coils works perfectly.
But for full functionality I need to be able to set the new target temperature, 
this is done with function 6 to address 0x1001. And I need to switch the 
thermostat between run/stop mode, a single coil at address 0x0814.

Any possibility this could make it in to the library?

Original issue reported on code.google.com by johan.wi...@gmail.com on 17 Jul 2014 at 1:59

GoogleCodeExporter commented 9 years ago
Maybe in the future..

Original comment by bester.j...@gmail.com on 31 Jul 2014 at 10:23

GoogleCodeExporter commented 9 years ago
I have added function 5 and 6 to the library, still have some work to do on my 
device and some verifications that the error handling works ok. Once done I can 
post a copy and maybe it can be added to the main code.

Original comment by johan.wi...@gmail.com on 31 Jul 2014 at 11:52

GoogleCodeExporter commented 9 years ago
I have tried to keep the library small that is why I have not included F5 and 
F6. I might do it in the future though.

Original comment by bester.j...@gmail.com on 4 Aug 2014 at 11:58

GoogleCodeExporter commented 9 years ago
Can you Post your Code? I need the funktion 6 too, for openHAB.

Original comment by j.wolte...@gmail.com on 19 Aug 2014 at 1:36

GoogleCodeExporter commented 9 years ago
Here is a DropBox link to my modified library. (also attached here).
https://www.dropbox.com/s/ag3lhvbjcnx8oza/SimpleModbusMaster-F5-F6-Mod.zip
Warning! I have changed the names of F15 and F16 to what the modbus 
specification calls them, made it easier for me.
Example of setting up F5 and F6:
* modbus_construct(pTC1runSV, 1, WRITE_SINGLE_COIL, 0x0814, 1, TC1runSV);
* modbus_construct(pTC1SV, 1, WRITE_SINGLE_REGISTER, 0x1001, 1, TC1SV);
For both you set the length to 1, other than that it works just as before.
As far as I have tested it all seams to work fine..

Original comment by johan.wi...@gmail.com on 19 Aug 2014 at 6:04

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the Master Lib, have you also a Slave Lib?

Original comment by j.wolte...@gmail.com on 19 Aug 2014 at 6:46

GoogleCodeExporter commented 9 years ago
Sorry no.. I only use the master function to communicate with thermostats.
If I get the time I can lock at the slave code and see if it's as easy to get 5 
and 6 in there as in the master.

Original comment by johan.wi...@gmail.com on 20 Aug 2014 at 7:02

GoogleCodeExporter commented 9 years ago
it would be cool, thanks

Original comment by j.wolte...@gmail.com on 20 Aug 2014 at 7:17

GoogleCodeExporter commented 9 years ago
Hello Juan, do you work on the function 6?

Original comment by j.wolte...@gmail.com on 26 Aug 2014 at 8:32

GoogleCodeExporter commented 9 years ago
Sorry no, I will not have time to look at the slave library in the near future.

Original comment by johan.wi...@gmail.com on 26 Aug 2014 at 8:40

GoogleCodeExporter commented 9 years ago
Hello there, any news on function 6? It would be helpful to be able to write 
single register on Arduino slave.

Original comment by k.la...@gmail.com on 27 Oct 2014 at 7:47