Structured text newbie

PiperJohn

Member
Join Date
Mar 2022
Location
Michigan
Posts
61
Hi folks, I am grateful for the opportunity to learn from you guys.

As an old school electrician I've come a long way with Allen Bradley.
I started out with Plc2 and worked my way up to the 5580 guard logix controller without any formal training.

I'm now trying to learn Structured text. I understand the basics but I am having a hard time understanding motion commands.
In ladder logic there's instructions like Maj, Mam, etc. How does this work in ST?

I've read some of the help files in Studio5000 (somewhat helpful) but i was hoping you guys could help steer me to a resource that'd be helpful.
The ones I've come across are too basic or way beyond me.

Thanks.
 
Hi folks, I am grateful for the opportunity to learn from you guys.

As an old school electrician I've come a long way with Allen Bradley.
I started out with Plc2 and worked my way up to the 5580 guard logix controller without any formal training.

I'm now trying to learn Structured text. I understand the basics but I am having a hard time understanding motion commands.
In ladder logic there's instructions like Maj, Mam, etc. How does this work in ST?

I've read some of the help files in Studio5000 (somewhat helpful) but i was hoping you guys could help steer me to a resource that'd be helpful.
The ones I've come across are too basic or way beyond me.

Thanks.




I have very little programming experience with RSLogix but I will still assume that the instruction are the same in LADDER and ST, that is if the instruction is available in both languages; some may be limited to ST.
 
I have very little programming experience with RSLogix but I will still assume that the instruction are the same in LADDER and ST, that is if the instruction is available in both languages; some may be limited to ST.


Various functions are limited to ladder/st/fbd. the most moronic one? SCP. Scale with Parameters. it was avail to Ladder in 500.. in 5000? FBD Only on install. Though you can easily add it as an AOI.
 
help file said:
Structured Text
MAM(Axis, MotionControl, MoveType, Position, Speed, SpeedUnits, AccelRate, AccelUnits, DecelRate, DecelUnits, Profile, AccelJerk, DecelJerk, JerkUnits, Merge, MergeSpeed, LockPosition, LockDirection, EventDistance, CalculatedData);

Type a MAJ in your structured text "MAJ();", put the cursor on it and hit F1 on your keyboard, you can view the help file for it.
 
Can't help with Motion, but it's worth pointing out that

XIC varIn XIC varTemp OTE VarOut translates to

VarOut :=varIn AND varTemp;

Not
If varIn and var Temp then
varOut :=1;
else
varOut:= 0;
EndIf
 
For rockwell - best sticking with Ladder and FBD if you do need to use ST then use it for things like calculations as its not so easy to debug.

Rockwells ladder is very good and very powerful.


Now if you were using a Beckoff(codesys) PLC i'd say do most in the ST language as the ladder sucks.
 
Interesting points, thanks.

I'm not writing a program. I'm trying to make heads or tails a newer machine in our plant.
To make matters worse, it's all written in Italian.

Unfortunately I only have Studio5000 basic at the moment. I did borrow the Pro version a while ago and copied a hard copy of the program just to try and understand ST in my free time.

I looked through the entire program and did not find any Mam or Maj commands.
The only code I found that seems relevant was enable drive and start commands.

I presume the individual parameters are written elsewhere.

Is there a sample motion program I can look at somewhere in English �� where I can learn the ST syntex?

Thanks.
 
Is there a sample motion program I can look at somewhere in English �� where I can learn the ST syntex?

Thanks.


Can you post the code you have problems with, no need for context, just a sample of what you described. The reasoned for that is I get the impression you or I are/am confusing DT syntax with Rockwell instruction use in ST. Structured text syntax is very simple and limited to a handful of instructions, some of which are used often like IIF and CASE FOR, and of course assignments, and some that are not used all that often, I can only think of WHILE right now.
Rockwell instructions on the other hand are plenty and very specific to their platform; you would have to read their documentation to learn how to use each.
 
The only problems in learning ST is the syntax, for example FBD functions are simple usually input pins on the left output pins on the right, however, in ST this is often the reverse, the other things are the use of brackets, & line terminators i.e. ; as posted above, the ST language is loosely based on Pascal.
 
Can you post the code you have problems with, no need for context, just a sample....


Thank you! :geek:

Below is code for servo driven press section of machine.

The program doesn't have a MAM anywhere to be found. Coincidentally, the 19 parameters between ( ) are the same number (19) as a MAM instruction.

MOV on the other hand oly has (10 parameters)?
This press moves two servos at once A416 and A416.
I omitted A416 at the bottom (duplicate of Positioner A415)

// PRESSORI MOTORIZZATI //
MOV_GUIDE(A415_MoveGuide,CICLO_PRESSORE1mot,A415_Posizionamento_ok,A415_Errore,Marcia_Assi,RESET_ASSI,TIME_CLOCK,Errore_Guide_PRESSmot1,A415_Start,A415_MoveGuideDurata);
MOV_GUIDE(A416_MoveGuide,CICLO_PRESSORE2mot,A416_Posizionamento_ok,A416_Errore,Marcia_Assi,RESET_ASSI,TIME_CLOCK,Errore_Guide_PRESSmot2,A416_Start,A416_MoveGuideDurata);

Positioner(A415_Motion,
A415Axis,
A415_TARGET_POS,
A415_LIM_MIN,
A415_LIM_MAX,
0,
A415_Start,
RESET_ASSI,
Immediate_ESTOP_F,
Delayed_ESTOP_F,
0,
A415_Velocity,
A415_Acc,
A415_Dec,
A415_Posizionamento_ok,
A415_Homed,
A415_Locked,
A415_Errore,
A415_ErrCode);
 
Ok I see if input Sb932.10 button is pushed a one shot scan will make One_Shoot_On true.
Then If Pressore1 and 2mot is at press cycle (step?) 0, it will move it to a target position of 1000 and change press 1 and 2 cycle to 10?

Am I close?

// Alza manuale pressori
ONE_SHOOT_ON(OsrManPress, SB932_10, OSR_SB932_10);

if OSR_SB932_10 and CICLO_PRESSORE1mot = 0 and CICLO_PRESSORE2mot = 0 then
CICLO_PRESSORE1mot := 10;
CICLO_PRESSORE2mot := 10;
A415_TARGET_POS := 1000;
A416_TARGET_POS := 1000;
end_if;
 

Similar Topics

Good morning. I'm doing a rehab and I need to recycle some part of the old code that won't change and that I need. This is a calculation that...
Replies
22
Views
1,164
I'm writing some structured text that's handling a data structure that comes from a PC. The PC structure is in the "new" LREAL 64-bit floating...
Replies
3
Views
437
Trying to put these equations in structured text program in a Micro 830. when I run the verify I get this error. ;:expected before this new...
Replies
4
Views
394
Hey all, Studio v20.05 Background. We are piggy backing another system to record attributes for product travelling down the line and several...
Replies
21
Views
3,418
Hi, In our company (programming mainly Beckhoff PLCs) we are establishing internal coding guidelines for ST. Until now, the conventions were...
Replies
5
Views
1,016
Back
Top Bottom