Help with a Flip/Flop Type of Logic

chippieboy

Member
Join Date
Sep 2019
Location
Silicon Valley
Posts
56
I am having this issue trying to figure out how to do this. I have a Hydraulic ram that travels when a machine is running. The ram extends to the maximum travel then trips a limit switch and then retracts to the minimum travel then trips the other limit switch extends to the maximum travel .This cycle repeats indefinitely until power off.
The main issue I have, is the hydraulic directional valve starts out in a neutral position during the first power up. The valve does not know what way to go. If the ram is not at either travel limit (touching the limit switch) it does not matter what direction to start first. I was thinking of doing a one shot at first cycle then some sort of flip-flop or a Set-Reset or a Keep-Reset when the PLC is powered up to trigger the hydraulic directional valve and let the cycle begin. The problem is if the ram is touching either limit switch at power up, I have no idea how to factor that in the logic and what way to send the Ram. This machine is using an Omron PLC but the logic should be the same or I can alter it once I understand how to do this. I can do it with AB as well. I attached a primitive picture of what is happening.
 
I would create a sequence, step logic, state machine, which ever term you like. Example...

1. Step 1 extend
2. Step 2 waiting for extend switch
3. Step 3 retract
4. Step 4 waiting for retract switch
5. Reset to step 1

If you start with the ram extended, it doesn't matter as the logic will see the switch then retract. You can reset to step 1 on power up, or make it retentive, your choice.
 
This is what I think about at 4am when I can't sleep. I gotta get a life ;-/

The logic below is essentially the same approach as LD's solution (good coders borrow; great coders steal;)), but it

  • is implemented as a pair of Start/Stop circuits,
    • so the seal-in branches allow replacing the Sets and Resets with direct* outputs
      • * i.e. -( )-s; I don't know the right phrase; it is OTE in the A-B fantasy,
  • adds a [Run] input to override everything and shut the ram off when not running,
  • eliminates LD's first rung (Network) by ORing the "start when in-between limits" with the start branches one of the Start/Stop rung
    • which LD could do by
      • swapping the RaiseQ and LowerQ -] [-s between the last two rungs
      • changing those tests to -]/[-s,
      • ORing a -]/[- of LowerQ with the -] [- of RaisedSwitch.
This is only an alternate implementation of and inspired by LD's approach. Even though this has near-symmetry, one less instruction and one less rung, code golf and density are not design goals, so I still think LD's is cleaner and easier to understand, and I would recommend that; adding ANDed Run bits is trivial if needed.


Code:
    Run           LoLim_Input           HiLim_Input    Up_Output
----] [---+-----------] [------------+------]/[-----------( )-----
          |                          | 
          |        Up_Output         |
          +-----------] [------------+
          |                          |
          |  Up_Output  Down_Output  |
          +-----]/[--------]/[-------+


    Run           HiLim_Input           LoLim_Input  Down_Output
----] [---+-----------] [------------+------]/[----------( )------
          |                          |
          |       Down_Output        |
          +-----------] [------------+
 




Awesome!


Slightly? I must pass along a compliment I once saw that an instructor wrote on an Intel 8085 programming class assignment: "Compact as hell!"


I have never seen that -]NOT[- instruction before; assuming left-to-right and top-to-bottom (which Siemens sometimes unwisely violates), that raises two questions:

  • Will both outputs be on for the one scan when LoweredSwitch has a rising edge?
  • Will both outputs be off for the one scan when RaisedSwitch has a rising edge?
Not that it matters either way for either question, just curious and wanting to understand.
 
Last edited:
I had trouble understanding the "Not" thing and the first example with the "S" & "R" outputs, I'm guessing those are Set & Reset functions. This machine is using a Omrom PLC and those functions I do not recognize. I do know the set reset in CX Programmer. I might give the other ideas a shot later.
 

Similar Topics

Hi all, my first post here, I've been lurking for a while. I'm a beginner and I hit a wall on one of my first projects I'm working on. I know it...
Replies
6
Views
2,540
Hi, We have an application that has a device that goes through a reboot (appears un-graceful) What then happens is the MVI module appears to hang...
Replies
0
Views
49
I am completely stuck on building a ladder program that requires a start button to be pressed 3 times to turn on motor 1. Then motor 2 starts...
Replies
20
Views
490
Hi all, i am the new controls guy at the plant and i have inherited a pc from the previous controls guy with Siemens tia portal version 16 and 17...
Replies
14
Views
407
Hello, I am trying to get a Yokogawa Hart pressure Transmitter and a Rosemount Temp Transmitter to read on a 1769-IF4 module on an L33ERM...
Replies
10
Views
348
Back
Top Bottom