×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Array of struct, ST language

Array of struct, ST language

Array of struct, ST language

(OP)
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  

RE: Array of struct, ST language

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.

RE: Array of struct, ST language

(OP)
Its a Beckhoff PLC. It has array handeling. I found out how to do:)

Thanks!

 

RE: Array of struct, ST language

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources