Contact and Coil | Nearly In Control

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.


3 comments

  • How to Write a Big PLC Program · Contact and Coil · February 21, 2016 at 8:49 am

    […] Mode […]

  • Mislav · November 15, 2017 at 12:25 pm

    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?

  • Author comment by Scott Whitlock · November 15, 2017 at 4:27 pm

    @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.

Leave a Reply

Theme Design by devolux.nh2.me