RS Logix Structured Text

1) I don't know - you should be able to test if and expression is true or not ... Manual says "IF photoeye THEN" or "IF NOT photoeye THEN" I'm not sure why you need TRUE ...
so I can have: xVar:=TRUE; but I just made my own TRUE and FALSE vars

2) BSL - Just multiply by 2 ... BSR Divide by 2
3) Exponentiation is performed with 2**10 not 2^10
this was just to help determine which bits of a INT are on, while easily identifying which bit I'm looking for like;
xDoubleWidthMode := (wJobConfig AND SHL(WORD#1,0))<>0;
xDoubleLayerMode := (wJobConfig AND SHL(WORD#1,1))<>0;
xDoubleLengthMode:= (wJobConfig AND SHL(WORD#1,2))<>0;

I know there's a lot of ways to do these things, trouble is I know little of the AB options, all help and advice is gratefully received!
 
You may be able to use some of the "ladder" functions in ST. Check the instruction help on an instruction by instruction basis to see if you are allowed to.

Keith

That's correct, no doubt I will find more functions excluded from ST as I go.

Thanks for the link!
 
I have new question;

It seems that ST doesn't allow me to copy a complete struct or UDT var do another one of the same type, like;

stStructVarCopy:=stStructVar;

So do I need to write an 'Add-On' instruction to move the UDT element by element? Or is there some better solution?

Thanks for all the help so far.(y)
 
Thanks Keith,

I wrote an AOI to handle the Structure Copy before your reply, but if you know a way to dynamically find the length of the Struct, to make to COPY instruction automatically adjust to the right size, then that would be perfect

Cheers

Jason
 
Since ST is text based, you can just copy and past the programs into notepad or an email to share them. You can export the tags to CSV it you need that.

Not sure why you're stuck on wanting to use
:= TRUE;
:= FALSE;

just use
:= 1;
:= 0;

The ST spec uses double asterisk for exponents
x**y is x^y

Fun fact, Maple (Symbolic math program from Waterloo) uses structured text, so you can copy and past the symbolic output from it into your structured text.

FOR, WHILE, CASE, IF, ELSIF, etc are all language standard and will work and you can access bits of an integer by using .<bit number> like this
MyDINT.0:= 1;

AB's support for structures is childishly bad and the auto-complete is terrible, but it does support using // for single line comments instead of having to put (**) everywhere.
 

Similar Topics

Good evening. I display the step number of a SFC on a display. Sometimes, on a trip, it goes quickly through many steps and I need to prove to...
Replies
1
Views
133
I am trying to learn structured text on the controllogix platform and have managed to fault the processor by creating an infinite loop. My problem...
Replies
21
Views
3,750
Hello, I please need your help why I cannot get the return parameter from the RET instruction to go into the return parameter in the JSR return...
Replies
6
Views
2,824
I am troubleshooting an issue on a controller with logic, function block and structured text. I am lost on how to read the structured text as...
Replies
8
Views
2,652
Hey! I'm looking for a way to reset a tag when the routine that sets the tag is disabled. For example: Routine 1 has the following If Tag1...
Replies
6
Views
1,817
Back
Top Bottom