CODESYS - Quick IO mapping

Hello, I wonder if there is a quick way to map bool (bits) from a Byte variable to a 8 digital inputs?
I know in Beckhoff TwinCat, one can declare an array of bools and then just click and choose elements of the array during IO mapping.
I have tried similar in CODESYS, but no luck.
I have also found something similar, even though I'm not using structures, but couldn't figure it out.
I'd like to avoid declaring 8 bool variables and then mapping them to DI 8 channels. There must be a quicker way.
I have attached a screenshot to be more clear what I'm trying to do.


Thank you!
 

Attachments

  • CODESYSIOmapping.png
    CODESYSIOmapping.png
    102.3 KB · Views: 53
Hi Pandiani:

I use the "AT" qualifier when I want to map declared variables to the IO memory of the CODESYS soft PLC.
Not sure if this is what you are asking, but I hope it is helpful

1725443827925.png
 
Hi Alfredo and thank you for the reply.
"What is needed is to declare an array of BOOL variables and assign each element of the array to the appropriate channel of a DI 8-channel device.
This task is relatively quick in Beckhoff. By declaring an array of 8 BOOL elements, I can easily link each input channel to a corresponding BOOL value within the array. This allows me to access and click on each array element within the program directly during IO mapping."

I thought there should be something very similar in CODESYS.
 
I think there is not any similar feature in CODESYS. And I know this mechanism very well in the case of TwinCAT, so I think I understand what you would like to have. But I maybe wrong and if so I hope someone corrects me.
The only way I am aware of for assigning IO to variables is through the AT qualifier at declaration.
 
If you want to do the mapping in code using the AT syntax, IDK how to help you.

But if you want to do the mapping in the IO Tree, this should work. Just get rid of the AT *address* in your declaration and enter the variable name in the device tree, as I have marked up in the screenshot

At least that is how it would work with the Ethernet/IP Scanner and Modbus Scanner

I do Object Oriented IO, so I have my own FBs that represent each Device or Card, and I handle any type mapping inside of those. Then I just point to the Input or output Var of the FB that represents the whole process image from the IO Tree interface.

I would like to eliminate the use of the IO tree entirely, but as of now, the E/IP driver doesn't support creating connections programmatically, so I am stuck with the IO tree interface.
1725457735123.png
 
This task is relatively quick in Beckhoff ... I thought there should be something very similar in CODESYS.
From my limited experience, CODESYS is a rudimentary implementation of the minimum functionality necessary to configure and program a PLC to do what you want. It has an open source-like aspect where publicly-available libraries and toolkits have been written and published to do more complicated tasks. The selling point seems to be that it does not tie one into a single vendor's overpriced ecosystem, which may be valuable in some environments e.g. if programming (one-time labor) costs are low.

Beckhoff with basic functionality is free for development, but it costs more for better functionality, if I understand the licensing model correctly.

So think of CODESYS as "some assembly required;" expect nothing, be satisfied with less, and you will not be disappointed.

I'm not saying it is a poor implementation or is a lesser value than the higher-end, and costlier, packages, just that they are targeting a different market segment.

I could be wrong here, so anyone feel free to correct me.
 
From my limited experience, CODESYS is a rudimentary implementation of the minimum functionality necessary to configure and program a PLC to do what you want. It has an open source-like aspect where publicly-available libraries and toolkits have been written and published to do more complicated tasks. The selling point seems to be that it does not tie one into a single vendor's overpriced ecosystem, which may be valuable in some environments e.g. if programming (one-time labor) costs are low.

Beckhoff with basic functionality is free for development, but it costs more for better functionality, if I understand the licensing model correctly.

So think of CODESYS as "some assembly required;" expect nothing, be satisfied with less, and you will not be disappointed.

I'm not saying it is a poor implementation or is a lesser value than the higher-end, and costlier, packages, just that they are targeting a different market segment.

I could be wrong here, so anyone feel free to correct me.

Careful, you're about to incur the wrath of the entire reddit population in the PLC forum.

"Ladder is obsolete, ST is the future, Codesys is king, AB is a relic and all programs should be written in text and require no modification in the future"
 
Careful, you're about to incur the wrath of the entire reddit population in the PLC forum.

"Ladder is obsolete, ST is the future, Codesys is king, AB is a relic and all programs should be written in text and require no modification in the future"

Not really... unless something has changed on r/PLC lately; when I used to go bash Rockwell, all the glorified maintenance techs would come out of their holes all butt hurt about it.


Codesys sucks, it just sucks a lot less than anything else in the PLC world.
 
Ladder is not obsolete, there are (on some platforms) where some of the functions are not available in ST, this often applies to specific functions to that PLC hardware.
ST is great for mathematical functions but due to FBD implementation it is often difficult to link one function to the next just like ladder, whereas it is possible to do it in FBD. The ST idea was also introduced to make it easy to inport into other platforms, however, due to hardware specific functions to each platform compilation will give many errors so probably easier to just re-write it. same as boolean expression it is certainly easier to drop AND/OR/NOT contacts on a ladder rung or FBD compared to writing the bools by typing. certainly easier to monitor flow in ladder conmpared to ST. So I think ladder (probably ladder & ST) is here to stay for some time.
 
From my limited experience, CODESYS is a rudimentary implementation of the minimum functionality necessary to configure and program a PLC to do what you want. It has an open source-like aspect where publicly-available libraries and toolkits have been written and published to do more complicated tasks. The selling point seems to be that it does not tie one into a single vendor's overpriced ecosystem, which may be valuable in some environments e.g. if programming (one-time labor) costs are low.

Beckhoff with basic functionality is free for development, but it costs more for better functionality, if I understand the licensing model correctly.

So think of CODESYS as "some assembly required;" expect nothing, be satisfied with less, and you will not be disappointed.

I'm not saying it is a poor implementation or is a lesser value than the higher-end, and costlier, packages, just that they are targeting a different market segment.

I could be wrong here, so anyone feel free to correct me.
Frankly I've used AB, Siemens, Codesys, Schneider, and they are more and more becoming the same type of interface as far as developing goes.

Whatever one I'm using the most at the time is the one I am most happy with, but in reality, they all have their strengths and weaknesses.


As far as the original Topic of this post, @pandia I implemented your declaration inside my version of codesys and it compiles fine. Gonna hook up some IO and see what happens.
 
Ladder is not obsolete, there are (on some platforms) where some of the functions are not available in ST, this often applies to specific functions to that PLC hardware.
ST is great for mathematical functions but due to FBD implementation it is often difficult to link one function to the next just like ladder, whereas it is possible to do it in FBD. The ST idea was also introduced to make it easy to inport into other platforms, however, due to hardware specific functions to each platform compilation will give many errors so probably easier to just re-write it. same as boolean expression it is certainly easier to drop AND/OR/NOT contacts on a ladder rung or FBD compared to writing the bools by typing. certainly easier to monitor flow in ladder conmpared to ST. So I think ladder (probably ladder & ST) is here to stay for some time.

Yeah, I agree, but that's the whole joke is that the text programmer guys who don't know anything about physical machine functions or control wiring are so stuck on wanting to do everything in ST, and refuse to understand how ladder works. They think it's extremely rudimentary and terrible because it looks like a simplified symbol based click/drag/drop programming style in some cases.
 

Similar Topics

Hi everyone, I'm New here I am currently working on a personal/learning project involving industrial communication and experimenting with a...
4
Replies
223
Views
Hi everyone! I'm not going to lie and claim this is my work at all or that I was the one to figure this out. Definitely all ChatGPT lol. But I...
1
Replies
214
Views
I asked this question in a CODESYS forum, but didn't get any replies , as I don't know how busy that forum is. Was wondering if anyone here could...
4
Replies
432
Views
Hi, I'm completely new to CODESYS so I'm guessing this is a basic error in my HMI Visualisation. When I try to go online with my Simulation, I get...
2
Replies
298
Views
I need Codesys v2.3 and eCockpit "the Programming software of WAGO". do you have installation files?
5
Replies
632
Views
Top