Souhaib
Is there currently support for memory bits (%Mx or %Mx.x) in the system? I'd like to use them for HMI communication instead of using unused physical outputs (%Qx.x), to keep virtual and physical addresses separate.
Reply 1 0
thiagoralves
Currently the only way is using %QX locations... I know it is a bummer. There are memory registers for words (%MW), double (%MD) and long (%ML), but not for bits. Once we finish redesigning our editor, I'll start redesigning the runtime, and memory bits is one of the first things that will be added, I promise! 😉
Reply 8 0
Souhaib
OK, thank you. As automation engineers, we often need to develop HMIs, and in almost all HMIs, there are many ON/OFF buttons that are of boolean type. These buttons must be linked to variables (contacts) in our ladder programs, and they need to be addressed as individual bits.
Reply 1 0
thiagoralves
Yeah, I know. %QX address will work for that. Just pick a distant address range so it won't ever conflict with your physical outputs.
Reply 1 0
CR
I discovered a useful way of at least partially working around this issue while experimenting with a Controllino Mega that I purchased for a lumber kiln reinstrumentation project. The Controllino Mega has 36 physical digital outputs, 20 configured as normal digital outs and 16 configured as 6 amp / 250 VAC relays. This being said, the OpenPLC project allows you to reassign physical I/Os, converting them from analog to digital or vice versa. For example, the Controllino Mega was designed with 16 analog inputs though in its default mapping for the Mega, the OpenPLC editor reassigns 11 of those as digital I/Os. You'll have to ask Thiago why this is the case.  I happened to need all 16 analog inputs on this PLC so I did not use the default Controllino Mega I/O mapping. I reclaimed the 11 reassigned analogs as analogs and therefore in my config, I have the exact number of digital outputs that the Controllino was designed for (36) .  D1 to D20 correspond to %QX0.0 to %QX2.3 (Modbus 0x1 to 0x20 on my Weintek HMI client) and R1 to R16 correspond to %QX2.4 to %QX4.3 (modbus 0x21 to 0x36 on my Weintek HMI client). I needed more bits for my ladder logic and I was stuck with the same problem (no addressable bit memory registers %Mx.x) so I decided to see if I could use %QX4.4 (modbus client 0x37) and beyond to store bits on the Controllino, even if they don't correspond to a physical digital output. Happily it works just fine., up to %QX6.7 or modbus 0x56 (I haven't experimented beyond that). This gives me an extra 20 bits which is enough for my project.   As a general disclaimer, I am not an automation engineer, just a partially automation literate tinkerer with a mechanical engineering background. This may all be self evident to much of the audience for this forum but it certainly wasn't for me. Best of luck.  
Reply 0 0
thiagoralves
Yes, that’s usually what I mean when I tell people to use QX as memory bits. OpenPLC maps a lot more QX addresses than what’s physically available.
 
As for the Controllino IO mapping, that was done by Controllino themselves. They wrote the OpenPLC driver
Reply 0 0
fg71
The confusing part could be that other PLC IDE use Internal Memory to read/write, there physical input and output is read only.
The notation for physical input and output is always the same. Other notation is used to force a state to variable that is mapped to physical output.
In other words its not the user who change the physical output its plc device that force the change.
 
ex.
 
User press a button on HMI screen to update the state of plc notation that is read/write. Next it force a physical output to change it state.
In other words Its not HMI device that directly change the physical output of plc device.
 
I do think its a difference between physical input/output compare to user input that use communication protocol to change the state.
And using the same notation could be confusing.
Reply 0 0
CR
 
First of all I'd like to say thank you again Thiago for this amazing tool. I've learned a huge amount about PLC programming from using OPENPLC project and I would have been unlikely to risk taking on my project if your tool hadn't been available and it hadn't had robust community support.
 
Unlike most professional users, I have no issues with using %Qx.x instead of %Mx.x for bit registers as I'm doing a one off project. I assumed that the Controllino Mega was maxed out at 56 %QX.X addresses (physical + virtual) because the of the reference to "some Arduino boards" in the second group of PLCs on the OpenPLC modbus address explainer page . For my current project, I only needed 20 extra bits beyond the physical outputs so I'm good with that.  Were I to embark on another project, I would most certainly use Openplc though I would want to know the exact number of %Qx.x bits I could address beyond the physical I/Os in case I needed more. Do you know if the three categories of PLCs outlined on the OpenPLC modbus address explainer page have exactly the number of addresses stated in the table or should it be read more like they have "at least as many addresses" as indicated in the table?  
 
Thank you again for your support.
Reply 0 0
fg71
I could use Siemens LOGO as example. The hardware device support 20 physical output that use Q1-20.
The base unit (The main PLC) have 4 physical output. This are mapped to Q1-4. To use Q5-20 I need to have expansion modules
to extend the physical output. It means I could in reality use Q5-Q20 and using this block as input.
 
If that is my approach and later decide to extend with 4 output modules and if Q5 is a input it will also be physical output.
 
My understand and I have read it in random places include IEC-61131-3 a PLC have input, output and internal memory.
And many PLC vendors us %M for memory flag instead of using %Q as memory flag to write a state from HMI.
 
The way Siemens have design the LOGO hardware Q1-20 is always physical output. That doesn't mean I couldn't use Q(n)
as inputs, but why should I do that when I have 64 memory register to control a bit by using memory flag.
 
I have always thought is good to separate physical output from internal memory and %Q for me is output and %M is memory location
When plc program logic have been tested we could assign %Q to physical output. In general I do not need any physical output
to simulate a plc program to know it behave the same if add physical output.
 
It have always find it little confusing why internal memory is accepted for integer but not bool. And if we define %Q as output
it couldn't be internal memory and that's why you see something else in other PLC IDE.
I have looked twice and IEC-61131-3 specification say that %Q is a output image and not memory location.
 
I have accepted that OpenPLC only use %Q but I do not agree it a good design.
Reply 0 0
thiagoralves
 
First of all I'd like to say thank you again Thiago for this amazing tool. I've learned a huge amount about PLC programming from using OPENPLC project and I would have been unlikely to risk taking on my project if your tool hadn't been available and it hadn't had robust community support.
 
Unlike most professional users, I have no issues with using %Qx.x instead of %Mx.x for bit registers as I'm doing a one off project. I assumed that the Controllino Mega was maxed out at 56 %QX.X addresses (physical + virtual) because the of the reference to "some Arduino boards" in the second group of PLCs on the OpenPLC modbus address explainer page . For my current project, I only needed 20 extra bits beyond the physical outputs so I'm good with that.  Were I to embark on another project, I would most certainly use Openplc though I would want to know the exact number of %Qx.x bits I could address beyond the physical I/Os in case I needed more. Do you know if the three categories of PLCs outlined on the OpenPLC modbus address explainer page have exactly the number of addresses stated in the table or should it be read more like they have "at least as many addresses" as indicated in the table?  
 
Thank you again for your support.
Yes, the amount of bits and registers should match what is listed here: https://autonomylogic.com/docs/2-5-modbus-addressing/
 
For the microcontroller boards, your maximum is %QX6.7
Reply 0 0
Reply