s5 program translation problem

TheCaptain2000

Lifetime Supporting Member
Join Date
May 2004
Location
Georgia
Posts
51
I have just recently been exposed to Siemens S5 programming language on some machinery that we are installing. Granted, some of it translates into ladder fairly easily, but some statements still stump me. Most of my experience has been with AB.

Someone please help me translate the following code:

AN F 30.7
= F 30.7
CD C 20
AN C 20
= F 33.0

A F 30.6
R F 30.6

AN F 33.0
BEC
A F 30.7
L KC 003
S C 20

AN C 20
BEC
A C20
S F 30.6
A F 32.7
S F 32.0
L FY 32
SLW 1
T FY 32
BE

When it comes to S5, I know the basics...

A = AND
AN = AND NOT
O = OR
ON = OR NOT
S = Set
R = Reset
F = Flag (Bit)
L = Load
C = Counter
CD = Count Down

...but there are several things that I cannot figure out. I have been through the old S5 manuals, but is there a Instruction and/or Operand index that will help me understand other parts of STL.

Again, I am most familiar with ladder so I need some help with STL.

Thanks a bunch in advance.
 
AN F 30.7
= F 30.7
CD C 20
AN C 20
= F 33.0

A F 30.6
R F 30.6

AN F 33.0
BEC
A F 30.7
L KC 003
S C 20

AN C 20
BEC
A C20
S F 30.6
A F 32.7
S F 32.0
L FY 32
SLW 1
T FY 32
BE

It looks like the counter counts down every second scan
If the counter <> 0 then it ends the block (BEC)Block end Conditional i.e. if not F33.0
If not counter this also ends block
when counter = 0 set the counter back to 3 (L KC003 S C20)
if the counter = 1 then set bit 0 in flag byte 32 (F32.0)
Shift left 1 place
Then store in Flag byte 32 (f32.0 to F32.7)
end block
What they do with it depnds where flag byte 32 is used & what F30.6 does again depends on other code that must set it somewhere.
 
*********************************
AN F 30.7
= F 30.7
CD C 20
AN C 20
= F 33.0

The above toggles F 30.7 every scan and decrements the counter on each scan that F 30.7 goes from OFF to ON. The counter output in Siemens is ON when the value is non-zero, therefore F 33.0 will remain OFF until C 20 has counted down to zero.
*********************************

A F 30.6
R F 30.6

The above resets F 30.6 whenever it is ON (its turned on a bit further down, so I presume it does what it needs to do within a scan).
*********************************

AN F 33.0
BEC

Until the counter reaches zero, end the block here.
*********************************

A F 30.7
L KC 003
S C 20

AN C 20
BEC


On F 30.7 being on here (which will be after the counter has reached zero) set the counter to a preset of 3, which will then turn the C 20 bit back on (its greater than zero), so the program will continue down. This part should always happen, so unsure why the BEC part was included.
*********************************

A C20
S F 30.6
S F 32.0

So this is setting F 30.6 and F 32.0 every 6 scans (count from 3 to zero)
*********************************

A F 32.7
S F 32.0


And this is re-setting F 32.0 again, if F 32.7 was ON (so its almost a reverse status loop from the shift further down)
*********************************

L FY 32
SLW 1
T FY 32
BE

This last part is shifting the 8 bits F 32.0 through to F 32.7 as below,
F 32.6 -> F 32.7
F 32.5 -> F 32.6
F 32.4 -> F 32.5
F 32.3 -> F 32.4
F 32.2 -> F 32.3
F 32.1 -> F 32.2
F 32.0 -> F 32.1
'0' ----> F 32.0

This is in isolation, its probably used as some sort of timing. very rough though as it works off the PLC scan.
 
Last edited:

Similar Topics

We have a new customer who has several S7-400's with programs that are documented in German. They would like us to translate them into English...
Replies
3
Views
3,027
Hey guys any idea on how we can take a plc program written in itailian and translate it into english, we have no support from the company that...
Replies
4
Views
2,690
Hi all, hope you are having a great day, I am in need of your help to create a AOI or program that does this kind of job: I have a IO Link...
Replies
0
Views
33
Hi. I have a 222 CPU. I need to recover the program from the eeprom memory. Is it possible?
Replies
1
Views
89
Can we use a Simotion D455 ethernet port x127 as a gate, to access S7-1500 plc Tia Portal program ? In the Simatic manager, we used Netpro to do...
Replies
2
Views
87
Back
Top Bottom