"If Then" Logic with CScape?

NickFaraday2

Member
Join Date
Mar 2011
Location
CA
Posts
14
Hey all... I'm slowly getting the hang of this Ladder programming stuff! Coming from lower level languages like C and Lisp its been frustrating to say the least.

Anyway... a common control used in programing is IF Then logic. How do I go about defining this logic in a ladder program? Specifically CScape?

Example:

Let say I have a function button F1. When F1 is press I set coil Q1 to On.

The next time F1 is pressed the following logic is run:

If Q1 = On then set Q1 to Off, else set Q1 to On

Thanks in advance... you guys have been a ton of help getting me started.
 
Last edited:
ok sounds like you want to toggle Q1 on and off by pressing F1. I have not used Cscape but I believe you want what we call a Flip Flop.
 
Hmmm...

I built the logic in your flip flop file in CScape and it does indeed flip flop between On and Off but no on F1 key press. It just flips on and off like a blinking light?

Am I missing something here?

What I'm looking for is

Press F1 = On, stays on till next press.
Press F1 = Off, Stays off till next press.
 
Hmmm...

I built the logic in your flip flop file in CScape and it does indeed flip flop between On and Off but no on F1 key press. It just flips on and off like a blinking light?

Am I missing something here?

What I'm looking for is

Press F1 = On, stays on till next press.
Press F1 = Off, Stays off till next press.
Nick, use a button on the screen.
Set it to "Toggle" under button properties.
Use the actual button contact in your program (%M001 for button 1).
--------------||--------------------------( )---
______________%M001 ______________________%Q1

You can also use the build-in buttons (F1, F2, etc).
Those you need to set the %SR to asign the function (Toggle, Momentary, etc).
Read up on %SR under help, it will point you to the correct register for setting up
the actual soft buttons, LEDs, etc of your unit.
 
Last edited:
Nick, use a button on the screen.
Set it to "Toggle" under button properties.
Use the actual button contact in your program (%M001 for button 1).
--------------||--------------------------( )---
______________%M001 ______________________%Q1

You can also use the build-in buttons (F1, F2, etc).
Those you need to set the %SR to asign the function (Toggle, Momentary, etc).
Read up on %SR under help, it will point you to the correct register for setting up
the actual soft buttons, LEDs, etc of your unit.

Ya, this is the functionality I'm trying to achieve, but I'm trying to learn how to build this kind of functionality with ladder logic. (not have to rely on the screen GUI button controls)

On off button was more of an example... I'm trying to learn the concept.

Re: I'm using the XLE105
 
This is a quick set up.
Check out the logic and also the actual screen.
The button properties can be manipulated when you open the graphics editor and double click on the actual button (called switch on the menu).
 
Ya, this is the functionality I'm trying to achieve, but I'm trying to learn how to build this kind of functionality with ladder logic. (not have to rely on the screen GUI button controls)

On off button was more of an example... I'm trying to learn the concept.

Re: I'm using the XLE105
Same concept applies to logic (no buttons).

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

Pretty generic set up.
You manipulate your logic, create the condition and the output follows
 
To add a bit more:

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

IF condition 1 = true
AND condition 2=FALSE
THEN Output (ON)
 

Similar Topics

Hello, I am going over some old code from days gone by. I would like the expert to confirm my findings to see if I got it correct. 1. B64:22/3...
Replies
7
Views
481
Hello, I´m having a problem trying to program in Ladder. An output should be trigged by two possible contacts. Take a look on the printscreen...
Replies
5
Views
186
I got my PanelView Plus 7 working with a Micrologix 1500. How would I connect my laptop to the PanelView to view the ladder logic while operating...
Replies
6
Views
210
Hello, I am trying to replicate a piece of logic on the PLC5 onto an SEL RTAC. I am using ladder on SEL and FBD. I am having issue on the ladder...
Replies
13
Views
307
Hello again..trying something on an existing poorly written program and just wanted to double check something system is an A-B MicroLogix 1200 In...
Replies
5
Views
201
Back
Top Bottom