Mode

A very common Ladder Logic Programming Pattern is the Mode Pattern. Most machines have a mode selection mechanism, and the most common modes are Auto(matic) and Manual:

Mode: Auto/Manual

Mode: Auto/Manual

The Auto/Manual Mode pattern above has two useful properties:

  • At program start, since the Auto Mode coil will default to Off, Manual Mode will be on
  • The system can never be in both Auto Mode and Manual Mode at the same time

The first property is important because we never want a system to start up in Automatic Mode. It’s always safer to start in Manual Mode and have the operator request Auto Mode. The second property is one we want for all Mode systems: only one mode can be active at a time.

There are machines that have more than two modes. The obvious example here is a mechanical press which has modes like Inch, Single, and Continuous, and sometimes several other specialized modes. We sometimes add an Off mode to that, meaning none of the active modes are selected. Even in the case of multi-mode machines, we want the same two properties of the logic: a safe default state, and exclusivity of modes.

Here is a 3-mode machine with an additional Off mode:

Mode: Three Modes and Off

Mode: Three Modes and Off

You may have noticed that the Mode pattern is just an extension of the Start/Stop Circuit pattern, just with more start buttons. That’s true, and we’re just enforcing that only one mode can be “started” at a time.

Notice that the Off mode is a pre-requisite to turning on any of the other modes. This ensures that when switching modes there is at least one PLC scan where none of the modes are active (except Off). Some programmers feel this is desirable (though I don’t think it’s a very important aspect). Perhaps you might want to execute some logic between modes, and examining the Off coil is a good way to do that. Note that this doesn’t, by itself, enforce exclusivity. That is, if we started in the Off mode, and if the mode buttons were physical buttons and I held two of them down simultaneously, then it would be possible for the machine to end up in two modes at once. Inserting normally closed contacts from all of the other buttons in each mode rung, combined with the precondition that the Off mode is active, is what enforces exclusivity. If I hold down two buttons, none of the rungs can be active and the machine will stay in the Off mode.

While most modern machines use mode selection through an HMI and some have physical mode pushbuttons, many older machines used a selector switch. In that case one position was usually not wired (typically “Off”), and the other selector switch positions were each wired into an input. In that case you didn’t need to seal in each mode with a branch circuit (because the switch itself “remembers” its selection), but you should do something similar to enforce exclusivity (in case of a wiring short circuit):

Mode: Three Mode plus Off Selector Switch

Mode: Three Mode plus Off Selector Switch

Note that in this case, one of the 4 coils will always be on, and in the event of a wiring short circuit (where two mode inputs are on) then the machine will default to the Off mode (which doesn’t have to be an Off mode but it should be a “safe” mode like Manual).

More Patterns of Ladder Logic Programming.


7 thoughts on “Mode

  1. Pingback: How to Write a Big PLC Program · Contact and Coil

  2. Mislav

    Are there any more reasons to making off mode a prerequisite to starting other mode? Or is it there just to ensure one off cycle between modes?

  3. Scott Whitlock Post author

    @Mislav – good question. In older systems they might typically have a selector switch to select modes, and I wonder if some actually required you to physically move the selector switch to the “Off” position before you moved it to a new mode. For instance, a 3-position switch might have left position is Manual, middle is Off, and right is Auto. In some ways that makes sure the switch is working? Ultimately I’m not sure. I always figured you could do some kind of housekeeping work while in the Off mode which you know will always happen between modes.

  4. Ian Pierre Charpentier

    i am applying this to a OFF, MANUAL, AUTO MODE, and a START AND STOP using a Main COIL to enable the whole system.
    but there is a safety issue i want to cover, everytime i turn OFF the system and turn ON again, the system is in the last MODE, and like you said, i want to start in MANUAL MODE always everytime the system turn on.
    How can i do that? i am almost there, but i dont find the way to do this.

    also, what do you mean with the PB and the SW next to some entries?

  5. Scott Whitlock Post author

    If you are using a coil (OTE instruction in Allen-Bradley) for the Auto signal, then it will default to off when the system is restarted. That is unless you’re using a different technology. It sounds like you might be using a PLC that has retained memory of coil values, but doesn’t reset OTE instructions to off during the pre-scan.

  6. Anders

    How about using some latches?

    XIC pb1 OTL mode1 OTU mode2 OTU mode3
    XIC pb2 OTU mode1 OTL mode2 OTU mode3
    XIC pb3 OTU mode1 OTU mode2 OTL mode3
    XIC pb_off OTU mode1 OTU mode2 OTU mode3

  7. Scott Whitlock Post author

    Latches aren’t appropriate for mode bits unless you want the mode to survive a power cycle of the machine, which in most cases you don’t. If you’re bringing up a machine from a power-off condition, you probably want to either make the operator choose, or set it to a default mode, like Manual/Hand.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.