S7 - STL question

mrKite

Member
Join Date
May 2002
Posts
4
Hi all,
I'm a student looking for a simulator for Siemens S7. Do you know where I can find one to download?

I have an STL exercise but I don't know if it works, since I don't have a simulator.

If you want to help, the scenario is that 'If input I1.1 is pushed 4 times, output Q0.1 will turn on after 8 sec'.

Here's what I did:

LD SM0.1
MOVW +0,MW1
R M1.1,4

LD I1.1
EU
+I +1,MW1

LDW=MW1,+1
S M1.1,1

LDW=MW1,+2
R M1.1,1
S M1.2,1

LDW=MW1,+3
R M1.2,1
S M1.3,1

LDW=MW1,+4
R M1.3,1
S M1.4,1
LD M1.4
TON T38,+80
LD T38
=Q0.1


Is it correct? Can you think of any other way?
Thanks in advance.
 
mrKite said:
Hi all,
I'm a student looking for a simulator for Siemens S7. Do you know where I can find one to download?

I have an STL exercise but I don't know if it works, since I don't have a simulator.

If you want to help, the scenario is that 'If input I1.1 is pushed 4 times, output Q0.1 will turn on after 8 sec'.

Here's what I did:

LD SM0.1 // On first scan?
MOVW +0,MW1 // clear push button counter
R M1.1,4 // reset bits M1.1 - M1.4

LD I1.1 // if bit 1.1 is on
EU // What is this? Convert bit to integer or unsigned?
+I +1,MW1 // Increment push button timer

LDW=MW1,+1 // if push button counter equals 1. IS THIS NECESSARY?

S M1.1,1 // IS THIS NECESSARY?

LDW=MW1,+2 // IS THIS NECESSARY?
R M1.1,1 // IS THIS NECESSARY?
S M1.2,1 // IS THIS NECESSARY?

LDW=MW1,+3 // IS THIS NECESSARY?
R M1.2,1 // IS THIS NECESSARY?
S M1.3,1 // IS THIS NECESSARY?

LDW=MW1,+4
R M1.3,1 // IS THIS NECESSARY?
S M1.4,1
LD M1.4
TON T38,+80
LD T38
=Q0.1



Is it correct? Can you think of any other way?
Thanks in advance.

For the benefit of Mr. Kite. ( Beatles? )

GET THE HINT? It looks like it will work. This is OK for a student. This is NOT OK for a real programmer. I am refering to lack of comments. I have no idea what the EU instruction does. You did give us a hint. I looked in my S7? manual and couldn't find it. You didn't even tell us it is a s7-200! S7-300s are quite different. Most people reading this post will not even take the time to figure it out because they don't program S7-200s and YOU DID NOT MAKE IT EASY FOR THEM TO HELP YOU!
 
I don’t think you code will work!
As far as I know there is now off-line simulation software for the S7-200 PLC from Siemens

To solve you problem, you could use a counter which counts till 4. If the preset value is reached, you can start a timer, and after the time is value is reached, you can set your output.
I have included the code for this program. You will only have to add the code to reset your input.
NETWORK 1

//
LD I1.0
LD C0
CTU C0, +4

NETWORK 2
LD C0
S V10.0, 1

NETWORK 3
LD V10.0
TON T37, +80

NETWORK 4
LD T37
S Q0.1, 1
R V10.0, 1
 
Thanks so much for your replies.
Please forgive my ignorance, PLC is something almost completely new to me and this was one of my first attempts to program something by myself.

Mr. Nachtwey,
EU is used to make something happen for one scan, similar to what a one-shot does in Ladder Logic. Also, I used LDW=MW1,+(number of push) each time, because I wanted to save the fact that the button is pushed every time. With a counter, as Abdel did it, it could be ok, but we were told not to use counters for this exercise.


Another solution I came up with is this, without using Counters or Icrement. What do you think?


LD SM10.1
LD I1.1
EU

S M1.1,1 // 1st push
LD I1.1
A M1.1
S M1.2,1 // 2nd push
LD I1.1
A M1.1
A M1.2
S M1.3,1 // 3rd push
LD I1.1
A M1.1
A M1.2
A M1.3
TON T38,+50
LD T38
=Q0.1


Thanks again! I would appreaciate any further help.
For the benefit of Mr.Kite. ;)
 
Dear Abdel,
it may sound silly to you, but what I did not understand about your code was V10.1. What exacly is this? I assume I could replace it with a memory, for example M1.1. Correct?

Abdel said:

//
LD I1.0
LD C0
CTU C0, +4

NETWORK 2
LD C0
S V10.0, 1

NETWORK 3
LD V10.0
TON T37, +80

NETWORK 4
LD T37
S Q0.1, 1
R V10.0, 1
 
Try this for size. I think it will work.

A I1.1
FP M10.0
= M10.1

A M10.1
CU C1

L C1
L 4
>=I
= M10.2

A M10.2
L S5T#8S
SD T1
A T1
= Q 0.1
 
Just thought I would have a go at a solution.

Note: no reset has been included.


LD I 1.1
EU
= M1.0 // Pulse of Input I 1.0 (Pulse of 1 scan only)

A M 1.0
A M 1.2
S M 1.3 // 3rd push

A M 1.0
A M 1.1
S M 1.2 // 2nd push


A M 1.0
S M 1.1 // 1st push


A M 1.1
TON T38,+50
LD T38
=Q0.1
 

Similar Topics

I'm having trouble trying to convert this code to ladder, anyone able to help me? A M4.0 A M4.1 A M117.0 AN M17.7 A ( A I38.6 AN I3.7 O ( A M4.5...
Replies
8
Views
1,206
Hallo Can you help me with understanding of the code below: M001: NOP 0 L #PUNTATORE L 16 *D LAR1...
Replies
3
Views
2,110
Hi all, I'm new to Siemens (I feel like a lot of threads start like this) and I'm trying to write a bit of code in STL. Currently we have a...
Replies
1
Views
1,276
O m0.0 O m0.1 A m0.2 = m0.3 Is the m0.2 "and'd" only with the m0.1 or is it "and'd" with m0.1 and m0.2 (which are or'd)? -{}-----|--()...
Replies
3
Views
1,700
I have an FB that had about 30 rungs of LAD code. I switched views (ctrl+2) to add some additional networks and create some STL code. Now, when...
Replies
6
Views
3,517
Back
Top Bottom