STL Help Needed

Join Date
Jan 2008
Location
Ontario
Posts
161
This one program where I need to use a pushbutton button to control a motor is giving me a bit of trouble. Normally this would be a sinch, but I'm having some trouble with this one.

Basically I need the pushbutton to turn on a bit when it's pushed and I need it to turn on the same bit when it's off. This function of the button can only start after it is first pressed.

I tried the usual

A I 0.0
ON I 0.0
= M 1.0

But the problem is that the bit must give a rising edge whenever the button goes from off to on or from off to on. The above logic won't give a rising edge. Furthermore, it will never give a rising edge except for the first time OB1 runs. Anyone help me out.

I've tried using every possible combination of FP, FN that I can think of and nothing works.

It's sort of like a toggle but not...
 
Try this!!!

O(
A I0.0
BLD 100
FP M 2.0
)
O(
A I0.0
BLD 100
FN M 2.1
)
= M 2.2

Then select View; then LAD to see what it looks like in Ladder fromat
(assuming it is a Siemens 300/400 PLC you are using?)
 
Posted elsewhere on this site, it doesnt converto to S7 Ladder but does convert to FBD, neat solution using XOR


Code:
A #PushButton
FP #AuxPB 
X #PBStatus
= #PBStatus
 
Lad

If u use 2 networks, then it can be written in Lad too.

It's called a Toggle Button


504bloke said:
Posted elsewhere on this site, it doesnt converto to S7 Ladder but does convert to FBD, neat solution using XOR


Code:
  A #PushButton
  FP #AuxPB 
  X #PBStatus
  = #PBStatus
 
Here are two example implementations (there are more) from your description. A more detailed description would help, for example what is it that turns the motor off ? What do you mean by "first pressed"

push001.JPG
 
PeterW said:
I'm struggling to understand exactly what is wanted.

Do you mean, press 1 = on, then press 2 = off???

This bit that I'm trying to control is being used in a SFB. The specific bit is a "position start" bit. IE, it starts the next positioning move.

I want an hmi button to remain inactive until first pressed. Once it is pressed, it will turn on the bit, thus starting a positioning move of the servo. When the button is hit again(turning the button off), I want it to turn on the bit again(but must give a rising edge, so I guess it needs to be turned off for at least one scan, then back on again). The button's on/off state will be read to send different values to the servo(this part is done and working fine).

so basically, you turn on the plc, and nothing happens yet. Then you press the button, and the servo moves to position 1, then once you hit the button again(turning the button off), the servo moves to position 2. If the button is again activated, the servo will move to position 1 again ad nauseum.

I haven't had a chance to try the examples here, but I will report back when I do.

I tried something simple before:


A I 0.0
ON I 0.0
= M 1.0

So AND button OR NOT button, turn on the bit.

Problem is that when the plc is turned on and OB1 runs its first scan, the button will be off, thus ON I 0.0 will be true and give a rising edge. This would move the servo to position 2 immediately, and after that the button will not do anything because turning the button on will not give a rising edge to M 1.0, since either one or the other must be true, M 1.0 will remain true all the time without giving a rising edge.

Anyways, I will try out the solutions provided sometime this week and let you guys know how it goes.
 
So after the first press the bit stays on, the second press turns it off.

Moggies's answer is what you want to look at.

A rising edge one-shot and a falling edge one shot.
 
So you want to get rising edge every time you push the button, but, in hmi you want to have different status of the button:

first time its pressed button on in hmi, rising edge--> servo drives to position 1
and
second time its pressed button off in hmi, rising edge--> servo drives to position 2
and
third time its pressed button on in hmi, rising edge--> servo drives to position 1
and so on?
 

Similar Topics

Hi All, I am a ladder programmer but I have to reverse engineer some STL code. I can't figure out this part. Can anyone help me translate this...
Replies
5
Views
1,659
Hi, I'm trying to convert some STL into LAD but I'm not the best at it. I just wondered if someone could have a look at the following 2 STL...
Replies
2
Views
2,624
Hi I wondered if anyone could help translate the following two networks into Lad as they don't directly translate. I've had a go myself but need...
Replies
20
Views
7,625
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
314
Hi! I am working on a project were we will be replacing an 300 CPU with a 1500 CPU and we are working on migrating / converting code. There is a...
Replies
9
Views
1,064
Back
Top Bottom