bertmelis / esp32ModbusRTU

modbus RTU client for ESP32
MIT License
70 stars 44 forks source link

Added Coil commands (5 & 15) #51

Closed mxbranson closed 3 years ago

bertmelis commented 3 years ago

I suppose you've tested the new FCs? What happens if you set more coils then fit into 2 bytes? --> are you sure the responseLength is always 8?

mxbranson commented 3 years ago

Hi, Yeah the response is always 8. (https://www.simplymodbus.ca/FC15.htm) Tested both single and multi (2) coil control. The messy bytecount code returns the number of bytes needed for any count of coils and updates the message accordingly. Compared message output to qmodmaster windows software output with the same # coils and start address up to 24 coils.

....and spotted a typo. Had a hard coded value for testing. Closing this and pushing an updated one.