PFC200 With Codesys 3.5 : Modbus TCP memory handling issue : memory area 1

Hello,

I am working on a project converted from e!Codckpit to Codesys 3.5 SP19 for PFC200 With Firmware28,
in the project we used WagoAppPlcModbus.FBsimpleTCPserver for setting the modbus server and not the codesys modbus configurator as described below :
Modbus FB *****
ModbusServer( xOpen := NOT TOF_Restart.Q AND NOT xOpen,
wPort := wPort,
utKeepAlive := udtKeepAlive,
xIsOpen=> xIsOpen,
xError=> xError,
oStatus=> oStatus,
udiConnectedClients=> udiConnected,
bUnitId := 1,
axDiscreteInputs:= axDiscrete,
axCoils:= axCoils,
awInputRegisters:= awInput,
awHoldingRegisters:= Modbus_Table);
With
TOF_Restart : TOF;
Modbusserver : WagoAppPlcModbus.FbMbSimpleServerTcp;
Modbus_Table AT %MW0 : ARRAY[0..12000] OF WORD;
udtKeepAlive: typKeepAlive;
xIsOpen: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiConnected: UDINT;
axDiscrete: ARRAY[0..1200] OF BOOL;
axCoils: ARRAY[0..1200] OF BOOL;
awInput: ARRAY[0..1200] OF WORD;
xOpen: BOOL;
wPort: WORD := 502;

the problem is when i tried to add holding registers on address %MW12300 to the Modbus Table i have an error C0111 : address %MW12300 out of range : calculated offset 25002, size : 24756

I think that i have an issue with handling memory on memory area 1 wich is fully used (its size match the maximum size i got on the previous error =24756Byte

Does anyone have any idea on how to increase allocated memory for memory area 1 or any other suggestion to solve this issue ? Thank you

Hello,

Normal I will say, the target have a finite number of Flag memory, you can check it by doing right click on the Application object and select properties, then in Target Memory setting you can see how much you have access.
I think by default it should be 24576 bytes which mean 12288 words, your array can only be from 0 to 12287.
There is a possibility to override this memory setting but I don’t know the limit and don’t recommend it.

Ps why do you need the %MW ?

Hello,

Thank you very much for the feedback @Wagolcard,

i have manually override values to increase %MW area to 65536byte as you described and now i dont have compilation error but i have an exception when trying to connect and load program to CPU, any ideas on how to manage this ?

image

i m using %MW because i need dynamic use of the registers to publish data of 50device on the modbus sever running on my CPU and on the same holding register area and which is used to be displayed on an HMI (depending on which device is displayed on hmi, i need to use the same registers to publish data of the 50devices : 1 device can be displayed at a time on hmi)

Thank you,

Hello,

I m using %MW to publish caluclated and internal variables for external devices through Modbus,
I dont use any IO Module for this project,

Thank you,