STL 101 Question

allstar

Member
Join Date
Oct 2006
Location
Porto
Posts
25
This is probably the newbiest question posted this year so far. Here goes..
Using STL how do you implement a load and transfer instruction that can be "condicional", like when you use the MOVE block in LAD? Regard the following code:
A I0.0
L 20
T QB10
I know this doesnt work since Load/Transfer are uncondicional instructions, so if I wanted to implement something like the following pseudo-code, what would I need to do?
If I0.0 == 1
then QB10 = 20
else move_along_with_your_life
How can I implement this just with STL? Is there another way to attribute values to variables besides using Load and Transfer instructions?
 
Maybe this will help

I would do this in ladder then display in STL. I do that a lot when I need to do something in STL that I know how to do in ladder.
 
Thanks for the quick replys. I was aware of the JMP solution precisely from using LAD and then seeing in STL. Just thought there would be another set of instructions to do this in a "conditional" way.
 
Peter's code is OK, but inverting the condition could be tricky in more complex applications. I would suggest using:

Code:
	A I0.0 
	JCN OVER
	L 20
	T QB10
OVER: (continue)
 
I don't really use JCN (as been picked up in the past) I hate it. I much prefer the code to do as you think, every time I see JCN I have to stand back and think about it because it does not sit well with the flow of code. The on;y time I see it is when I look at code in STL that was written in SCL.

Its like invertng the way you think.
 
Couple more questions

Since I already had this thread open, no need to open a new one since the following questions are still "new-to-this-PLC-thing" related.

The first one, is there a limit as to how many CALL instructions you can do "simultaneously"? For example, if I had the following:
A I 0.0
S M0.0
CALL FC1
S M0.1
CALL FC2
...
And so on for, let's say, 50 times. Is there a restriction to this? I assume that since theres a time delay associated with the CALL instruction, by the time the 50th instruction was to be executed we might have a significant time consume there or is this not the case?

Another question, completely urelated, is that I'm finding the s7-200 more resourcefull in some ways then the s7-300. Simple things implemented under the s7-200 read-only special memory (SMB0 to SMB29) like a Always_On bit or First_Scan_On or MIN / MAX scans (similar to the ones available on OB1) and many more are, although simple, nice to have available from the start.
I havent found similar "out-of-the-box" simple features like these on the S7-300. Am I not looking where I should?
It just seems odd to me that they would develop a better (more capable) PLC series and cut on these tiny but enjoyable things to have.
 
First question regarding limit to block calls. You would be limited by the number per network, can't remember the max size of a network, I wouldn't normally get that close.

The scan is a limit to the amount of work your PLC can do, same as any PLC, dependes on the amount of code and the instructions you use.

The only time delay between calls is the length of time to process the previous block and the time to process the call (the second is almost nil).

Not sure what the A I and M conditions are for in your sample as you call the blocks unconditionally, could just as easily have been

call fc1
call fc2... etc.

In 300's you would have to create your own 'always on' flags, the first scan is usually uneccesary as you have the first scan OB's, I have seen these created as well.

You are correct 300's and 400's save scan time info in the TEMP's of OB1.
 
Thanks for the quick reply. Indeed I was aware that CALL is unconditional, I just inserted the extra lines to simulate something happening between the calls.
Going to try to find out the limit to those block calls under 315 cpu.
 
Last newbie question of the week... I promise!

I want to make multiple comparissons and if all of them are true then perform something. Imagine this:
A "E1_3"
L "sMM1"
L "SPsMM1"
==I
L "sMM2"
L "SPsMM1"
==I
JC _001 //this should only happen IF all 3 are true (at least it's what I wanted)
Well.. this doesnt work as I want because what is checked at JC is the result of the last 2 comparissons, right? So, it doesnt matter if "E1_3" == 1 like i wanted.

How can I do this? I thought that I should use the status word bits, like I could save RLO to BR and then carry BR bit along these comparissons but I cant do something like "L BR", since LOAD instruction doesnt support bits.
 
allstar said:
This is probably the newbiest question posted this year so far. Here goes..
Using STL how do you implement a load and transfer instruction that can be "condicional", like when you use the MOVE block in LAD? Regard the following code:
I know this doesnt work since Load/Transfer are uncondicional instructions, so if I wanted to implement something like the following pseudo-code, what would I need to do?
How can I implement this just with STL? Is there another way to attribute values to variables besides using Load and Transfer instructions?

This is how I used to do it with S5. Created a FB that performed load and transfers, that way I could do a conditional load and transfer. I created several types. On that transfered a value to a DB.DW. One that transfered DB.DW to DB.DW..etc


load.jpg
 
Combo said:
I also was learned to use JCN, aren't most programmers using this method ?

I suppose it comes from coding S5 for many years, there was no JCN instruction, so spent so long with JC that it ingrained that you jump when the condition is true.
 

Similar Topics

i am new to simatic manager and i am trying to figure what this part do in the code : A I 5.6 = DB50.DBX 4.6...
Replies
3
Views
133
Hello everyone, can anyone help me with covert the STL code to ladder. Iam using plc s71200. A %DB1.DBX33.7 // angel of vaccum...
Replies
2
Views
208
Hello nice to meet you, im new in here, I'm currently trying to convert code written in STL for a S7-400 to SCL for an S7-1500, because when i run...
Replies
5
Views
317
First off thank you in advance. Second I am very new to STL. I am trying to build a counter that has one count up and 23 count down options. Am...
Replies
6
Views
377
Hi Siemens Experts, I am hoping someone can shed some light on my issue. I have uploaded the code from a S7-300 (317-2PN/DP) using Step 7...
Replies
9
Views
675
Back
Top Bottom