thiagoralves
Hello everyone!
 
I just pushed a little update that might get some of you excited. The Modbus address space was expanded on all microcontroller boards (except 8-bit AVR) to include memory locations %MW (16-bit words) %MD (32-bit double words) and %ML (64-bit long words). These extra memory locations are available as Modbus holding registers. Here is the breakdown of the address space:
 
%QW0 - %QW31 -> Modbus holding registers 0 - 31
%MW0 - %MW19 -> Modbus holding registers 32 - 51
%MD0 - %MD19 -> Modbus holding registers 52 - 91 (each MD takes up two Modbus registers)
%ML0 - %ML19 -> Modbus holding registers 92 - 171 (each ML takes up four Modbus registers)
 
The nice thing about this is that now you can read/write REAL and LREAL variables on Modbus registers. All you have to do is locate your REAL variable on any %MD location or your LREAL variable on any %ML location. Larger integers are also possible using these expanded locations. On the modbus master side, you just need to configure your application to concatenate Modbus registers to form an IEEE float (two registers in case of REAL or four registers in case of LREAL).
 
I’ll update the documentation on the website about this change, but you guys can start using this now if you want. Just update your editor and start coding 🙂
Reply 2 0
epgodoy
Great addition!. Tks
Reply 1 0
Pedro Coimbra
Fantastic.
It would be great if you could also implement memory bits " %Mx or %Mx.x"
This would be very useful for communicating with an HMI, I know it is possible to use "unused coils" (%Qx.x) for this purpose, but it would be much better to separate the physical addresses from the virtual ones.
Tks
Reply 3 0
thiagoralves
Roger that! 😉
Reply 2 0
jblb
as @Pedro Coimbra i think memory bits would be a great feature
Reply 0 0
rhysperry111
Thanks so much for this <3. Will follow up with the ESP32 PR soon
Reply 0 0
Seafoxc
Fantastic.
It would be great if you could also implement memory bits " %Mx or %Mx.x"
This would be very useful for communicating with an HMI, I know it is possible to use "unused coils" (%Qx.x) for this purpose, but it would be much better to separate the physical addresses from the virtual ones.
Tks
That would indeed be a good extra feature. For now you can use a Function Block to write the bits in a word and then you can access those bits in the HMI software. This is how they did it where I used to work where the main reason was for less work for the programmer to connect pre-made Function Blocks with pre-made grafics (object oriented) using just one word to connect the two. 
I have no Idea what I'm doing...
Reply 0 0
Naresh
Hello everyone!
 
I just pushed a little update that might get some of you excited. The Modbus address space was expanded on all microcontroller boards (except 8-bit AVR) to include memory locations %MW (16-bit words) %MD (32-bit double words) and %ML (64-bit long words). These extra memory locations are available as Modbus holding registers. Here is the breakdown of the address space:
 
%QW0 - %QW31 -> Modbus holding registers 0 - 31
%MW0 - %MW19 -> Modbus holding registers 32 - 51
%MD0 - %MD19 -> Modbus holding registers 52 - 91 (each MD takes up two Modbus registers)
%ML0 - %ML19 -> Modbus holding registers 92 - 171 (each ML takes up four Modbus registers)
 
The nice thing about this is that now you can read/write REAL and LREAL variables on Modbus registers. All you have to do is locate your REAL variable on any %MD location or your LREAL variable on any %ML location. Larger integers are also possible using these expanded locations. On the modbus master side, you just need to configure your application to concatenate Modbus registers to form an IEEE float (two registers in case of REAL or four registers in case of LREAL).
 
I’ll update the documentation on the website about this change, but you guys can start using this now if you want. Just update your editor and start coding 🙂
THIS ARE WORKING ONLIY ANOLOG OUTPUT ONLY OR ANOLOG INPUT ALSO ?
Reply 0 0
thiagoralves
None of them. They are Modbus holding registers working as internal microcontroller memory 
Reply 0 0
Naresh
MY MODBUS TCP SLAVE HAS FLOAT 32BIT  1 ,3,5,7 ADRESS I WANT READ WITH OPENPLC RUNTIME BECASE RUNTIME WORK AS A GATEWAY DNP3    MY FINAL GOAL IS READ MODBUS FLOAT DATA ON DNP3 ANOLOG INPUT
Reply 0 0
thiagoralves
This thread is about microcontrollers running OpenPLC. DNP3 is not supported on microcontrollers. Even for the Linux runtime where DNP3 is supported, you can read floats on DNP3. Only integers are supported
Reply 0 0
nestorlevi
Hello everyone!
 
I just pushed a little update that might get some of you excited. The Modbus address space was expanded on all microcontroller boards (except 8-bit AVR) to include memory locations %MW (16-bit words) %MD (32-bit double words) and %ML (64-bit long words). These extra memory locations are available as Modbus holding registers. Here is the breakdown of the address space:
 
%QW0 - %QW31 -> Modbus holding registers 0 - 31
%MW0 - %MW19 -> Modbus holding registers 32 - 51
%MD0 - %MD19 -> Modbus holding registers 52 - 91 (each MD takes up two Modbus registers)
%ML0 - %ML19 -> Modbus holding registers 92 - 171 (each ML takes up four Modbus registers)
 
The nice thing about this is that now you can read/write REAL and LREAL variables on Modbus registers. All you have to do is locate your REAL variable on any %MD location or your LREAL variable on any %ML location. Larger integers are also possible using these expanded locations. On the modbus master side, you just need to configure your application to concatenate Modbus registers to form an IEEE float (two registers in case of REAL or four registers in case of LREAL).
 
I’ll update the documentation on the website about this change, but you guys can start using this now if you want. Just update your editor and start coding 🙂
It's excellent news. In some low-end PLCs the memories share an address, for example %MD0 uses the address of %MW0 and the next address, that is %MW1. Is there a possibility of doing it with 8-bit AVRs? How to save memory and have the new feature.
Excellent work.
Reply 0 0
Angelo_KARTE
Hello everyone!
 
I just pushed a little update that might get some of you excited. The Modbus address space was expanded on all microcontroller boards (except 8-bit AVR) to include memory locations %MW (16-bit words) %MD (32-bit double words) and %ML (64-bit long words). These extra memory locations are available as Modbus holding registers. Here is the breakdown of the address space:
 
%QW0 - %QW31 -> Modbus holding registers 0 - 31
%MW0 - %MW19 -> Modbus holding registers 32 - 51
%MD0 - %MD19 -> Modbus holding registers 52 - 91 (each MD takes up two Modbus registers)
%ML0 - %ML19 -> Modbus holding registers 92 - 171 (each ML takes up four Modbus registers)
 
The nice thing about this is that now you can read/write REAL and LREAL variables on Modbus registers. All you have to do is locate your REAL variable on any %MD location or your LREAL variable on any %ML location. Larger integers are also possible using these expanded locations. On the modbus master side, you just need to configure your application to concatenate Modbus registers to form an IEEE float (two registers in case of REAL or four registers in case of LREAL).
 
I’ll update the documentation on the website about this change, but you guys can start using this now if you want. Just update your editor and start coding 🙂
Hi Thiago:
It takes a lot of memory to use the Modbus RTU and most of the times I just need a few Modbus Registers.
 I think it would be more useful if we just configure the required Modbus Registers, even choose different communication, and speed ports in the same program (Arduino Mega)
Name   Class   Type   Location   CommPort   SpeedPort  Modbus Address     Initial Value   etc.
 
In the case of Arduino Nano, just by choosing Modbus RTU, poor Arduino Nano almost run out of memory.
I suggest using the most standard configuration
Discrete Output Coils       00001-09999
Discrete Input Contacts   10001-19999
Analog Input Registers     30001-39999
Holding Registers               40001-49999
 
I LOVE openPLC btw!!!!
Reply 0 0
thiagoralves
Having that kind of granularity control is quite complex to add, and would only benefit the small 8-bit micros like the Uno and Nano, which in my opinion are a dead end for anything larger than a traffic light example. Arduino Uno and Nano running OpenPLC should be treated as candy: popular with kids, but not for serious business. They can run out of memory VERY quickly, which should be expected for a platform running a full IEC 61131-3 runtime with Modbus support on 2KB of RAM!
 
There are so many other hardware platforms to choose from, even from Arduino itself, that will offer a much better experience with OpenPLC when compared to Unos and Nanos. And for the price point, RP2040 for example is actually cheaper than an Arduino Uno, has a dual-core 32-bit CPU, and has 264KB of RAM. More than enough to run OpenPLC.
Reply 0 0
Angelo_KARTE
Having that kind of granularity control is quite complex to add, and would only benefit the small 8-bit micros like the Uno and Nano, which in my opinion are a dead end for anything larger than a traffic light example. Arduino Uno and Nano running OpenPLC should be treated as candy: popular with kids, but not for serious business. They can run out of memory VERY quickly, which should be expected for a platform running a full IEC 61131-3 runtime with Modbus support on 2KB of RAM!
 
There are so many other hardware platforms to choose from, even from Arduino itself, that will offer a much better experience with OpenPLC when compared to Unos and Nanos. And for the price point, RP2040 for example is actually cheaper than an Arduino Uno, has a dual-core 32-bit CPU, and has 264KB of RAM. More than enough to run OpenPLC.
Hi Thiago:
I will try RP2040.
I like Arduino Mega because it has way more pins than Nano.
What do you recommend to replace Arduino Mega?
Thank you very much!!!!
Reply 0 0
Reply