Beginner programmer

mmatienza

Member
Join Date
Jan 2024
Location
Singapore
Posts
3
Dear all,

First of all thanks for letting me join this forum.

I just need some help in one of my programming exercises. Being a beginner, I'm still having a hard time figuring out how to properly plan the logic (for example, how to determine which input/output do I need to use to reset a timer). Hope you can share your strategy on how I can effectively plan before staring the ladder programming.

By the way, this is the scenario that I am currently working on. Hope you can share your thoughts on how I can figure this out. I don't necessary need you to provide me the ladder logic for this. Just give me some guidance.

1. When button A is pressed, green light will turn on.
2. When button B is pressed, red light will t urn on.
3. When both buttons are pressed, green and red light will alternately turn on every 1 second.
4. When both buttons are released, both lights will be off.

Thanks in advance. Cheers!
 
Welcome to the forum.
#1 and #2 are pretty simple. If button A and not button B then turn on the green light. If button B and not button A then turn on the red light. That also satisfies #4.
For #3, you will need to create some logic to control a bit that alternates between on and off every second. You could do that with flip-flop logic and a one second timer. Many PLCs have a built-in one second contact. Another way could be a two second timer and a comparison instruction to control a bit that is off for the first second and on for the second.
Please post what you've done so far and we'll help debug it for you. It will be helpful to tell us what PLC you're using.
 
Hi, Steve. Thanks for your insights, really appreciate it. Btw I'm using Allen Bradley Studio 5000. I'll try to work on the hints that you gave and update here after. Thanks a lot! 🍻
 
Refer to these two resources:



http://www.contactandcoil.com/patterns-of-ladder-logic-programming/

Notes

  • that latter link has an example of a flashing timer
  • you are only dealing with relay i.e Boolean logic at this point:
    • A is either pressed (value is 1) or released (value is 0)
    • B is either pressed (0) or released (1)
    • Flash timer 1 is either not yet expired (0) or expired (1)
    • Flash timer 2 is either not yet expired (0) or expired (1)
    • There are only three operations in Boolean logic
      • AND
      • OR
      • NOT
    • each XIC (normally open) and XIO (normally closed) contact is an atomic boolean test, which
      • reads the value of its operand, and
      • compares that operand's value to either a constant 1 (XIC) or a constant 0 (XIO).
      • if
        • BOTH the operand's value is equal to the constant's value.
        • AND the input rung to the contact is True,
      • then the output rung is assigned a value of True
      • otherwise the output rung is assigned a value of False
    • The Boolean AND operation is implemented by arranging instructions (atomic boolean tests)* in series along a single rung or branch.
      • both instructions in series need to assign True values to their output rungs for the final output rung to be True
    • The Boolean OR operation is implemented by arranging instructions* in parallel branches.
      • if EITHER the upper branch's final output rung is True, OR the lower branch's final output rung is True, then the point where the branches reconnect is assigned a value of True
    • Boolean NOT operation is implemented by using the XIO ("Normally Closed") contact
      • If the operand value is 0, then the XIO output rung is assigned a value False
      • If the operand value is 1, then the XIO output rung is assigned a value of True
So the problem described in Post #1 can be re-written in Boolean Prose

  • If
    • [(A is pressed)
    • AND (B is pressed)
    • AND Timer 2 is not expired]
  • Then run Timer 1
    • Timer 1 running to its expiration is the first half of the flashing cycle



  • If
    • Timer 1 is expired
  • Then run Timer 2
    • Timer 2 running to its expiration is the second half of the flashing cycle
    • Note that when Timer 2 expires,
      • that will reset Timer 1 above,
      • which will also reset Timer 2,
      • which will start Timer 1 again




  • If
    • EITHER
      • [BOTH (A is pressed)
      • AND (B is released)]
    • OR
      • [(A is pressed)
      • AND (B is pressed)
      • AND (the first timer is not expired)]
  • Then turn on the Green light



  • If
    • EITHER
      • [BOTH (A is released)
      • AND (B is pressed)]
    • OR
      • [(A is pressed)
      • AND (B is pressed)
      • AND (the first timer is expired)]
  • The turn on the Red light


And that Boolean Prose can be directly translated to ladder logic.
 

Similar Topics

Hello all I am trying to learn some basic programming for my job. What I am wanting to do is on a Allen Bradley plc is write a program sequencing...
Replies
6
Views
1,943
Hi there :) I'm new here and in programming PLCs. Actually, the only time I've programmed PLCs were when I was in school eheh I will, most...
Replies
0
Views
1,279
First I'm am using the logixpro trial version form the learning pit. I'm having some problems with a program. I need some help. It would be...
Replies
6
Views
2,927
Hi ppl, I've just finished my second year studying Electronic & Computer Engineering @ Uni, in the UK. During summer, i'm involved in an...
Replies
1
Views
5,769
Hi all, Writng a FB in ST on Beckhoff TC for a pulser which turns on and off on a cycle, is paused by turning bControlInput to FALSE, but resumes...
Replies
6
Views
249
Back
Top Bottom