Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array of struct, ST language

Status
Not open for further replies.

hapetter

Mechanical
Apr 12, 2002
28
Hi.

I try to implement an array of struct in IEC61131-3 ST language.
The C code look like this:


Code:

Struct BDD
{
Unsigned char a1;
Unsigned int a2;
Unsigned int a3;
Unsigned int a4;
}

struct BDD BDD_table[4] = {
{'X', 1, 1, 2},
{'a', 0, 100, 0},
{'a', 1, 100, 2},
{'X', 2, 5, 4}
};So:
How to declare array of struct and fill inn data in array?

Thanks!

Best Regards
Hans Pettersson
 
Replies continue below

Recommended for you

As far as I know 1131/3 does not define array handling
What PLC is this for?
Typically in a PLC you would need to create your own arrays using Data blocks.
 
Its a Beckhoff PLC. It has array handeling. I found out how to do:)

Thanks!

 
Interesting that you mention this. It actually was for this purposes I had the initial question about the struct. It is part of such a state machine where states and transistions is compressed into a table. It is super efficient. The link you had describe a variant of the system I use.

I did success to implement the system on my PLC for the first time yesterday:). I have used it on microcontroller and C language only before.

- Hans
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor