carlz0r
Hello all. I have a home backup generator from Generac and have been using the open source Genmon (https://github.com/jgyates/genmon) utility for remote monitoring.

I'm in the process of trying to connect to the generator as a modbus slave through OpenPLC and while I'm having some success, it seems that due to the way Generac has setup their registers I am unable to read them all.

They have their registers setup entirely as input/holding registers with an address range that greatly exceeds (around 1500) the maximum number of registers in the modbus standard and in OpenPLC. 

I was wondering if anyone has experienced this with any other modbus devices and could pitch in? Or if there's a way to modify the OpenPLC code to allow reading a larger range of input/holding registers?
Reply 0 0
thiagoralves
OpenPLC uses libmodbus to communicate with slave devices. As per standard, you can access registers from address 0 to 65535 (16-bit address), which means that 1500 is inside this range and should work. Now, if you're saying that you need to read 1500 registers at once, this is quite impossible due to the nature of the Modbus protocol. Because the number of bytes for register values is 8-bit wide and maximum modbus message size is 256 bytes, only 125 registers for Modbus RTU and 123 registers for Modbus TCP can be read at once. If you need to read more than 123 registers at once, you could create two or more slave devices on OpenPLC, each one reading a different portion of the range you need.
Reply 0 0
carlz0r
I don't need to read all 1500, as there are a few key ones low in the address range (0-20 or so) and a few high up in the address range (1400-1500 range). I will try setting up multiple modbus slaves for the various portions of the range and work from there. Thanks for the help!
Reply 0 0
carlz0r
That worked out as you suggested, however now I've run into a different problem. The poll rate is a bit too high and ends up triggering an "EEPROM ABUSE" warning due to too many reads/writes over a certain period. I know that the global poll rate can be changed for slave devices but has anyone/is there a way to set poll rates individually?

I have a Mega that I'd like to poll fairly continuously however the generator only needs to be polled once every few seconds.
Reply 0 0
thiagoralves
Well, the way I coded it only allows the polls to be controlled globally. You can change that editing /webserver/core/modbus_master.cpp. A dirty way to do this would be to hardcode the poll rate you want for the Arduino and let all other devices to follow the global poll rate
Reply 0 0
carlz0r
Well, the way I coded it only allows the polls to be controlled globally. You can change that editing /webserver/core/modbus_master.cpp. A dirty way to do this would be to hardcode the poll rate you want for the Arduino and let all other devices to follow the global poll rate


Sounds good, thanks!
Reply 0 0
Reply