TwinCAT 2D Array

PLCJoe

Member
Join Date
Aug 2010
Location
UK
Posts
3
Hello,

My project task is to read from EtherCAT 128 analogue input channels at 500Hz, then transfer them to the PC as close to Real time as possible via ADS from Beckhoffs TwinCAT PLC.

The PC is going to be retrieving data every 100ms, by this time the EtherCAT should have received 50 pieces of Data per channel (500 samples a second per channel. 0.1s = 50)

This means i need to retreive from the PLC the following structure of Data:

Channel1 Channel2 Channel3 Channel4 Channel5 ....
0.11111 0.222222 0.333333 0.444444 0.555555
1.11111 1.222222 1.333333 1.444444 1.555555
2.11111 2.222222 2.333333 2.444444 2.555555
.....
...
..

I am using Structured Text and have managed to get a basic connection and pass data back and forth.
The only way I could manage to get this to work is by creating 128 arrays, then having 128 pointers in an Array then indexing the "pointer array". I dont like this solution because it is not expandable and seems very elaborate for achieving something that could be quite simple.

My question is how do I create a 2D array in TwinCAT PLC?
How do i use ADS (any variety .Net, ActiveX, dll) to retrieve a 2D array (I am using Labview but any example in VB or C will be greatfully appreciated)?

Thanks in advance

Joe

:site:
 
Last edited:
Ahhh Ok, found out how to Declare a 2D array now:

EngineeringVars : ARRAY[0..100, 0..100] OF LREAL;

Now all I have to do is to work out how to read a 2D array.
I've tried splitting it into 128 single arrays in a for loop but it reads so slow.
 
Hmmm.... Take that back.
I can not have a 128 dimension array. It only allows a maximum of 3 Dimensions.
Right back to the drawing board.
 

Similar Topics

Hello guys! I have a ARRAY[0..2047,0..3].. I want to have column by column, how can I read it? Data := ARRAY[0..2047,0..3] OF STRING; In Matlab...
Replies
0
Views
1,207
Hi, Right now Im working with a Wenglor vision system connected to a Beckhoff PLC. From the camera im getting a string of measurement that i send...
Replies
9
Views
5,465
Hello, I want to put I/O states into an array so i can read this array over ads communication with an other plc. how can i make this array in...
Replies
0
Views
1,965
I like to make a hmi with the TwinCAT Visualization. The project i am working on now is a conveyor belt with products on them. The plc code...
Replies
0
Views
1,985
Hello All, I am trying to do something quite simple but not use to some of Twincat's instructions/syntax. I am programming in...
Replies
4
Views
21,046
Back
Top Bottom