Hi
First of all thanks for your support! Your solution is working, but I have some comments (I performed a lot of tests in last two days).
Regarding dnp3 – the best software to test the dnp3 operation is Opendnp3 Simulator by Automatak (dnp3 driver used by OpenPLC was written by them, therefore is fully supported by their simulator)
hxxxxs:// automatak.com/opendnp3/simulator/setup.msi
It’s a little bit problematic idea to increase event_buffer_size and database_size to 900 (the way dnp3 push all values is different from Modbus, where only specific value is read by master – here outstation send all values at once, when get read request from the master) – therefore a lot of garbage send by the outstation, therefore I did some change in the software to support offsets. This change also allow user to read just required number of datapoints and also starting from 0…
I define additional optional parameters - offsets of 800 for Digital Outputs and Inputs, and offset of 100 for Analog Outputs and Inputs in dnp3.cfg file (in case the user have another offset it can be configured in the file, or it can be commented and work in way you mentioned in you last reply).
Then I read offset parameters in dnp3.cpp from dnp3.cfg and update or read relevant/corresponding values which implemented by slave device (Arduino or another)
I’m attaching both files for your reference (If you wish you can implement it into the next OpenPLC release)
Another problem I found, belongs to Modbus master, polling external slave device. In Analog Input (Input registers), the last register value is never read – the bug found in Modbus_master.cpp(line 465)
int return_val = modbus_read_input_registers( mb_devices[i].mb_ctx, mb_devices[i].input_registers.start_address,
mb_devices[i].input_registers.num_regs-1, tempBuff);
should be:
int return_val = modbus_read_input_registers( mb_devices[i].mb_ctx, mb_devices[i].input_registers.start_address,
mb_devices[i].input_registers.num_regs, tempBuff);