S7 300/400 STL-SCL Difference in Programming ?

erdemsvri

Member
Join Date
Jul 2009
Location
Germany
Posts
172
Hello everbody out there.

I have 2 topics actually I wanted to share and get your opinions about but since they are related I sum up in one thread.

1) We are going to change a S7 414-2DP 6ES7 414-2GX03-0AB0 V3.1 to a S7 319F CPU, The reason is we want to use fail-safe functions of new CPU and we have some S7-319Fs here so we want to make them standart. We want to keep at the beginning old program from S7-400 which is mixed in STL and FDB and add new Fail Safe Program and run the plant. We do not want to worry about old program which is running actually and try to understand it in short time and so on just copy paste if possible. Then we will do the research about program, explore it and add some more functionality that we want later.

The question is could there be any difference for STL program in S7 300 and 400 families? Is STL language totally standart and same for S7-300 and S7-400s? I want to make sure of this before touching the PLC and I know that S7 400 have 4 registers and S7 300 have only 2 but I am not sure if this makes a point to be careful during engineering phase?

2) Some time ago I programmed a SCL function block for a S7-300 for some device and commissioned it successfully. I am sure that this code runs good and later on I wanted to use the same block for another machine which had S7-400. I copied SCL Source code and complied it, the same SCL code had a different outcome for S7-400..... So the SCL compiler output STL code reacts differently in S7-300 and S7-400 PLCs. Which brings me to the question 1 above now! I had not so much time by then so instead of doing research about topic I rewrite the code totally in STL and it went good. But since in the future I can and will have the same case and doubts, I wanted to learn details from Siemens Pros.

Any documents maybe about STL SCL programming differences (if there are) or point to care about between 300 and 400 families about STL/SCL? I did some search in internet but nothing useful came up.

The Software I use are:

Simatic Manager V5.5 SP2 HF1
S7 SCL V5.3 + SP6


I wish everybody nice day and looking forward to hearing your ideas.

Thanks.
 
Last edited:
Sorry if have to ask for a clarification, but since I find this subject very interesting I'll dip my nose in it.

Did the program you made, compile differently? I think you said it did, but not certain.

If it did, was the function it was supposed to perform the same but the code performed it differently? Or did it not function as intended?
 
Hello, thank you for the interest no problem...

Did the program you made, compile differently? I think you said it did, but not certain.

If it did, was the function it was supposed to perform the same but the code performed it differently? Or did it not function as intended?

I can not know for certain if the program is compiled differently because it is a compiler issue and i did not have the time to compare the output STL code in some text compare software by then. But it is a good idea to compare the output STL codes for S7-300 and S7-400.

To make it clearer what I did;

Copy the SCL source file to the new project where the PLC is S7-400 and compile it with same computer and software and I downloaded the output FB to CPU, then I realize that the functionality of the FB is different than S7-300s for which
I actually wrote and tested the SCL Source succesfully.

I hope I explained it clearer this time. If still any questions, please do not hesitate to ask.
 
Can you post the SCL in question that operated differently between the 300/400 systems?

As you say, the 400 has 4 accumulators which can be used for slightly more effecient arithmetic processing. However, the small snippet below produces the same STL code in both a 300 and 400 project.

Code:
FUNCTION fc400:REAL
VAR_INPUT
x:REAL;
y:REAL;
END_VAR
BEGIN
FC400:=x*4 + y*8;
end_function
 
Hello

OK, the code is attached as TXT file you can change the extension SCL and import or easyly copy paste into new source.

What worked different I can not hundered percent remember actually at the moment but it should be when the next fault button is pressed it comes back to the old number and the rollover from 999 was not correct or something like that. What the code is doing is;

The is a fault DB in PLC and 3 * 7 segment display with a BCD driver. When there is no error the output is 000 and when new error comes the the error number is displayed on 3 * 7 Segment Display and if multiple faults occurs with the next fault button the operator can jump to other fault. From 999 with next button rolls over to the start. And for example 015 was displayed and new alarm comes 534 then the display switches to newest alarm. I know it is an ancient!!! system but sometimes the customer is very strict about their traditions.

I know SCL draws more attraction, and I agree but can you please be so kind to inform me more on more Question1?

Can I copy the STL code from S7-400 to S7-300 and go to sleep at night comfortably? (Or vice versa 300 to 400) This is very important for us at the moment. My previous experience tells me Yes but I can not make %100 sure. Please direct me in the right way.

Thanks.
 
Last edited:
Hello


Can I copy the STL code from S7-400 to S7-300 and go to sleep at night comfortably? This is very important for us at the moment. My previous experience tells me Yes but I can not make %100 sure. Please direct me in the right way.

Thanks.

No you cannot sleep at night.

If someone has coded the S7-400 to rely on there being 4 accumulators, it will not work the same when run in a S7-300
 
Out of context: In "ALARM_DISPLAY.TXT", wouldn't it be alot faster to just load the whole area into temp area in FB41 and then scan it? Instead of continuously loading bit by bit from the DB?

Edit: I don't have access to a list of instruction execution times for anything as fast as a 319 or something from the 400-series, but multiple small accesses to Main memory should still be slower than accessing the Local data stack.
 
Last edited:
No you cannot sleep at night.

If someone has coded the S7-400 to rely on there being 4 accumulators, it will not work the same when run in a S7-300

That is not so good. Maybe sleepless nights again... Can you please explain me in more details? Which aspects do I need to control? Is there a relevant document or a list of functions that have difference between these families?

Thank you.
 
You can use the STL help to go through all the intructions and read about the implications of 2/4 accumulators.

PUSH/POP spring to mind.

ENT/LEAVE don't execute on a S7-300 so a fault will occur if these instructions are encountered.

Arithmetic instructions will leave different results in the other accumulators depending on wether there are 2 or 4

(As a side note PLCSIM executes with 4 accumulators even if you download a S7-300 project).
 
This is really a lot to do, checking every statement in STL and there is a risk of missing something. So we better develop a new strategy how to deal with the update of PLC.

Thanks for the useful information you provided, in the light of this entrace info I found the link from Siemens website

http://support.automation.siemens.c...objaction=csview&extranet=standard&viewreg=WW

It is a comparision of S7-318 2DP / S7-319 and remarks the point to be careful when updating to S7-319 CPU. Since 318 2DP and 400 have similiar concept, this document can guide us.

There is also another point except the ones already stated;

Jumps in logic operations sequences
When programming jump operations, ensure that the jump destination is always at the start of the logic operations sequence. The jump destination may not be located within a logic operations sequence.

Have a nice day.
 
I compiled your posted SCL for both S7-300 and S7-400 CPUs and the same STL was produced for each CPU. Looking at the compiled STL, the SCL compiler does not appear to use 4 accumulators if available (even with code optimisation turned on).
 
Hmmm ok but I am sure we had this problem because I spend a half day before giving up the SCL code. Then maybe there could be some succesive arithemtic operations or logical jumps conditions in STL code that are differently handled by 300 and 400.

I will try to search this in output STL code when I can spare some time. But thinking it is very complicated I can only do it later.

Thanks.
 

Similar Topics

I want to convert program written in stl to ladder.Sometimes it is failing as the programmer do not write nop statement in code.İs there a...
Replies
3
Views
4,719
Hello everyone, One of our machine we use Siemens Cpu315-2dp. And this cpu communicate with 4 Lenze servo drives series 9300 via profibus. Also...
Replies
0
Views
176
Hi guys, I'm having problems converting WinAC (WinLC RTF F application) to S7 300 project based on CPU 319F-3PN or S7 400/416F-3PN. The problem is...
Replies
0
Views
614
Hello All I hope you are well and safe. I have a problem that I could use your appreciated input for: SW: SIMATIC MANAGER v5.5 SP3 HW1...
Replies
2
Views
1,219
Hi What stage of its life cycle, S7-300/400 controllers are at now? In my existing unit, we are using these controller and in near futher there is...
Replies
8
Views
7,027
Back
Top Bottom