Simple problem-ladder diagram

mikas_m

Member
Join Date
Feb 2007
Location
ck
Posts
154
Hello to all,

I have one problem and hope you'll be able to help.

I want to write simple ladder diagram program. I want to programm the following logic:

There is one push button PB1 as input and two outputs. When user presses PB1 outout 1 will be active. Next time when PB1 is pressed, output 1 will be turned off and output2 will be active. Again, new press of PB1 will turn off output 2 and turn on output 1.

What would be the easiest way to do this?

Can you give me any advice?

Thanks
 
Hello,
I have one more question.
Why there is need for 1sec timer in Terry's example. I tried without timer and it's working OK...
 
I'm trying to solve this on my own.
This is what I'm trying to realize in ladder:
Let's say that output 1 is named TARGET_BIT.
Previous value of TARGET_BIT is named T_B_prev.
Equation is the following:
TARGET_BIT = PB*NOT(T_B_prev)+NOT(PB)*T_B_PREV, where * means AND function and + means OR function.
In form of table:
PB|T_B_prev|TARGET_BIT
0 0 0
0 1 1
1 0 1
1 1 0
Problem is as you know how to set up T_B_prev. At the end, TARGET_BIT becomes T_B_prev, but I don't know
how to assign that.
So one network will be as follows:

PB T_B_prev TARGET_BIT
|-------| |-------|/|-----------( )
| |
| |
| T_B_prev PB |
|-------| |-------|/|----|


Now, how to perform transfer of TARGET_BIT to T_B_prev?
If I just add second network something like this:
TARGET_BIT T_B_prev
|----| |---------( )
since program is executed in cycles, this will not solve the problem.

Basically, in the begining I was trying to solve this problem with above's equation, but now, I'm not really sure this is the right way.
How to think in terms of cyclic execution, are there any tips and tricks?
Thanks
 
Last edited:
Your circuit is performing exactly like your truth table. As you said, it is simply occuring every scan instead of only at the instant the the pushbutton is pressed.

Basically you want some method that will cause the first two lines of your truth table to execute on the first button press and the second two lines to execute on the next button press. Another way of saying this is you only want to have the PB condition in your circuit true for a single program scan after the button is pressed. The condition will then be false for all other scans until the physical button is released and pressed again.

I'm being purposely vague. Let me know if you need more hints.

Keith
 
Yes Keith, that is what I need. I have found solution by searching the forum. However I'm trying to make ladder that will contain my network to implement the equation.
This is what I manage to do, it seems to work, but I'm interested if there is more elegant solution:

PB aux(positive edge) enable_PB

|-------| |-----(P)-----------------(Set)



enable_PB Qp Qn

|-----| |-------|/|------|-------( )

| |

| enable_PB Qp |

|-----|/|-------| |------|



PB enable_PB

|-----| |------------------------(Reset)



Qn Qp

|-----| |------------------------( )




Thanks
 
Last edited:
To be honest no, I didn't read the whole thread.
I've read only first 3-4 postos, ut I 'm glad I manged to do it myself.
Thank you all for help.
 

Similar Topics

I have a program that does a 7 second "scan" sensor calibration routine whenever a setting (setting is called assistance level or "AL" and ranges...
Replies
3
Views
212
It would be awesome if someone could help me out with this problem. We can only use basic XIC XIO OTE OTL and OTU instructions. I'm not sure on...
Replies
33
Views
9,066
I'm trying to create a momentary push button using the pre-made libraries. Unfortunately, it seems they are all latching switches?? I'm not sure...
Replies
1
Views
1,400
For some reason, I cannot get even the most simple integer to integer function to work, e.g., (MOV N18:24 to N31:2). I have also tried MULT...
Replies
10
Views
2,535
Hi! Found this forum by accident and so far it seems to be active. :) PROBLEM: I want to use ARRAY OF BOOLs to determine which coils are set and...
Replies
1
Views
2,676
Back
Top Bottom