Talkredius
My System configuration :
 
OpenPLC running on a barebone PC with the recommended Debian system
configured a Kostal Solar inverter as Slave device ( Port 1502, Slave ID 71, a Kostal specific config):
Slave_device-detail.png
 
Then I started the blank programm and tried to read the %IW100... %IW119 values from a remote PC ( not the barebone with the running OpenPLC ) with Modbus Mechanic at Modbus address 100...119 from OpenPLC I only got zeros.
 
What I tried so far :
 
Reading the Modbus registers directly from the slave device with Modbus Mechanic works, single register and 20 registers in one go.
Writing a value to Modbus register 100 (openPLC) and read it back works with Modbus Mechanic
 
Deliberately defined the Holding register of the slave device as Input register and got the error message illegal instruction, as expected. That means OpenPLC is trying to read the registers of the slave device.
 
What I'm missing here ?
My understanding is, that the blank program does nothing but should read the configured Modbus registers of the slave device.
The IW100 ... IW119 should be mapped to registers 100...119 on the PC running OpenPLC
 
Do I have to write a program and declare some variables to access these registers ?
Are there some debug options which I can swicth on to dig deeper ?
Reply 0 0
thiagoralves
Chances are you're reading the wrong OpenPLC registers. %IW100 is at Modbus Input Register 100, not Holding Register 100. See https://autonomylogic.com/docs/2-5-modbus-addressing/ . Make sure you're using Input Register to read the data from OpenPLC.
 
Another thing you can try is just add variables to your blank program located at %IW100 onwards. This is not necessary for OpenPLC to read the data from the slave, but it makes it easier for you to see the data on the Monitoring page of the webserver.
Reply 2 0
Talkredius
Chances are you're reading the wrong OpenPLC registers. %IW100 is at Modbus Input Register 100, not Holding Register 100. See https://autonomylogic.com/docs/2-5-modbus-addressing/ . Make sure you're using Input Register to read the data from OpenPLC.
 
Another thing you can try is just add variables to your blank program located at %IW100 onwards. This is not necessary for OpenPLC to read the data from the slave, but it makes it easier for you to see the data on the Monitoring page of the webserver.
thx a lot , that was my fault using the wrong function code 0x03 (reading Holding Registers ) instead of 0x04 (Read Input Register), case solved and closed
Reply 2 0
Reply