Codesys Mapping I/O with Array

Hey everyone,

Does anyone know an easy method to map IO with an Array without having to manually enter all of them one by one? I am trying to map IO BYTEs with an array of SINTs but I do not know if its possible to do that without having to enter them one by one.

Thanks in advance

Capture.PNG
 
I dont know about array but if you want to speed it up you can create a global variable list where you write something like this:
Code:
VAR
   yourVariableName: BOOL AT %IBX.X;
END_VAR
That way you can bulk create it in a spread sheet program and pastenit into the global variable list. Im pretty sure that is the syntax, feel free to correct me or by checking the codesys help.
 
Thank you ojz0r and AlfredoQuintero for your responses. I have seen this post before where you can define in the tag itself for the IO it should be mapped to. But unfortunately I could not find a way to map an array of BYTE to an array of IO (BYTES) in one go. The way you have described is to map one array to one object which I can by defining it as:

yourVariableName AT %IBX: yourDUT;

But I need to map an array of object to an array of object (for example a SINT or BYTE), please correct my syntax

yourVariableName AT [%IB408...%IB425] : ARRAY [0...17] OF BYTE;
(In the above example %IB408 to %IB425 are of type BYTE)

The above line gives the following error :
[ERROR] PLC: Panasonic_Robot [Device: PLC Logic: Application](Line 5): C0030: Direct address expected after AT instead of [

Would really appreciate if someone could help me on this

Thanks!
 
Maybe if you describe your purpose there might be another solution?


Do you really need the direct I/O in an array or would a copy suffice with a move instruction?
Code:
yourArray[0] := yourInputVariable0;
 

Similar Topics

Hi there I am trying to use the Modbus RTU Slave FL6 Flexem with Codesys, but I am having trouble mapping my variables to the holding registers...
0
Replies
613
Views
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...
12
Replies
3,813
Views
Hi everyone, I am using Codesys for the first time (V. 3.5 SP16 Patch 3) and I have used only Allen Bradley before this. I am struggling to...
17
Replies
7,991
Views
Hi everyone, I'm New here I am currently working on a personal/learning project involving industrial communication and experimenting with a...
4
Replies
222
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
213
Views
Top