supremesports
Hi,

It looks like I'm unable to use higher registers. I was trying to put read-only variables for master devices (devices that simply reads values from PLC such as time). Read-only values would have been in holding registers 5000 to 5999. But it looks that anything higher than 2999 doesn't work, it accepts it to load and run, but all values remain to 0 in Radzio.

Is there any software limits???
Reply 0 0
thiagoralves
The limits are defined in modbus.cpp file:

#define MAX_DISCRETE_INPUT              8192
#define MAX_COILS                       8192
#define MAX_HOLD_REGS                   8192
#define MAX_INP_REGS                    1024
#define MIN_16B_RANGE                   1024
#define MAX_16B_RANGE                   2047
#define MIN_32B_RANGE                   2048
#define MAX_32B_RANGE                   4095
#define MIN_64B_RANGE                   4096
#define MAX_64B_RANGE                   8191


As you can see, holding registers are usable up to address 8191. If you try reading something above 8191 it will give you a Modbus error instead of returning 0. However, you may also notice that this address range is divided in analog outputs (0 to 1023), 16-bit memory registers (1024 to 2047), 32-bit memory registers (2048 to 4095) and 64-bit memory registers (4096 to 8191). Using 16-bit variables located in a space reserved for 32-bit variables can lead to inconsistency. In fact, to use the 32-bit range for example, you are supposed to locate your variables as %MD0 instead of %QW2048.
Reply 0 0
supremesports
I knew there had to be something 🙂 So, unless I run out of registers, I will work it like this... If I understand correctly, it means I can only use holding registers up to 2047? Could this be modified, can I allow more registers in the future??? I'm pretty sure that I'll use a huge quantity of holding registers as they seem to be the only one that master devices can write along with coils. So it means my HMI and other master devices will use many of them.

Thank you
Reply 0 0
thiagoralves
If you need more registers, I’m pretty sure all you need is to modify the #define statements from that file. I would also check the size of the buffers as well to make sure they are big enough to fit  
Reply 0 0
supremesports
Hi,

I started to take a look at the resize. It appears that 1024 for buffer size seems to be hard-coded in many files. I don't have time to parse everything, I was wondering if you remember which files would be important to verify? Or do I simply concentrate on the modbus.cpp, glueVars.cpp and ladder.h?
Reply 0 0
thiagoralves
I believe you should look for that on modbus.cpp, glueVars.cpp, ladder.h and dnp3.cpp. Just keep in mind that glueVars.cpp is auto-generated every time you compile a new program. If you want to modify it permanently, you will have to modify the glue_generator.cpp program inside the /utils folder, compile it again, and then move the executable over to /webserver
Reply 0 0
Reply