Search:     Advanced search


Discuss your PLC and automation problems for Allen Bradley, GE, Omron, Mitsubishi, Modicon, Panel Views, RS View, ABB, Adept Robots, Cognex etc. You can also submit and download sample PLC code.

If our forums and knowledge base still hasn't got your PLC operational, we recommend contacting PDF Supply and Electric for PLC repair and replacement parts.

Programming Application - Functional Alarms with Allen Bradley

Article ID: 48
Last updated: 05 May, 2004

At some point in your PLC career you probably have been exposed to writing alarms for a machine. There are several alarms that I normally include when I write logic for a machine from scratch. Some of those alarms might be "cycle time out" alarms, or "part not detected" alarms. I think the most important alarm to me is what I call the "functional" alarm.


When designing a machine's electrical package, typically I use a prox switch for each motion of an air cylinder. This would generally include an extended and a retracted PLC input from each cylinder that causes motion in either direction of the cylinder. A lot of times prox switches fail, or even during your normal machine cycle you could have part jam that would cause a prox switch not to be made or create a valid input condition. So in essence, I created a "functional" alarm.


Functional alarms defined by me are generally two conditions:


  1. Neither prox switches extended or retracted is made while the machine is in a normal air on state.
  2. Both prox switches extended and retracted are made while the machine is in a normal air on state.

Condition number one above is generally caused by four scenarios:


  1. A prox switch failed.
  2. A prox wire is cut.
  3. A prox position has loosened and no longer can sense the direction of the cylinder.
  4. During a normal cycle, a cylinder moved but could not complete the move because of a jam. 

More often enough, scenario number three is the most common, but stops your machine if a prox switch has been moved to the wrong place and can no longer sense the direction of the cylinder. These kinds of problems can earn yourself a phone call at 2 AM to come look at a machine if your maintenance guy can't figure out why the machine won't start.


Condition number two above is generally caused by two scenarios:


  1. A bad prox switch that is stuck "ON".
  2. A prox wire is cut and grounded "ON" (NPN) or shorted "ON" to positive voltage (PNP) 

Any of the two scenarios above are not good because now you're not sure if the switch is made because of motion or if you have a true failure.


So generally to write a simple two rung alarm in Allen Bradley would look something like this:

If the machine AIR SWITCH is ok, indicating that the cylinder should be fired one way or another because air is on and theoretically the cylinder should be pushed to one end of the stroke or the other and not either prox switch nor both prox switches are on at the same time, you can then time these conditions with a timer. The timer should be just longer than the time it takes your cylinder to fire and change directions from one end of the stroke to the other. If the cylinder takes too long, then this alarm will set a bit which you can then send an alarm to your HMI to alert your operator or maintenance personal of the problem on your machine. Obviously if a prox switch has moved out of adjustment, you can direct your maintenance personal with an alarm to the exact prox switches or at least exact cylinder that caused the alarm. Hopefully then allowing you to sleep better at night knowing your staff can handle any easy prox adjustment problems. Just remember our motto, "The Program Never Fails".

Download a whole machine example with alarms here.

Article ID: 48
Last updated: 05 May, 2004
Revision: 1
Views: 13762
Comments: 4
This article was:   Helpful | Not helpful
Prev   Next
EtherNet/IP Modbus TCP Implementation Guide     Programming Application - Controlled Start and Stop

Comments rss
brian ahern | 20 May, 2004 12:00 AM
How would you isolate a cycle stop and an immediate stop with this format?

How would you initiate a tool return with this code?
Posted: 12 years 5 months ago   | Permalink
Chris Elston | 22 May, 2004 12:00 AM
From my point of view, it doesn't matter what state the machine is in. If the air is ON and OK, then there should be an input ON from one switch or the other. Typically I write a cycle stop and I have a ""tool return"" or when an operator hits the ""reset"" button to home double air valves. But again, this code just checks the switches for failure. It doesn't matter if the machine is in motion, in cycle, tool returned or not. I simply want to know if I have a switch failure, and the air is ok, that I will get an alarm and not allow the machine to function anymore until the broken, mis-adjusted switch is repaired.

To see an example of my cycle stop code you can read about it at the below link and download a whole machine code that might help answer your question even further.
Posted: 12 years 4 months ago   | Permalink
Chris Elston | 09 Jan, 2007 12:00 AM
Nope, using a fill command unlatches all the latches to speedy up ladder logic.
Posted: 9 years 9 months ago   | Permalink
Patrick Allen | 09 Jan, 2007 12:00 AM
I notice you turn on your alarm bits using an OTL. But nowhere do you unlatch the bit for those alarms. Instead you fill the B files with zeros on a reset. Wouldn't your OTLs still be latched?
Posted: 9 years 9 months ago   | Permalink

Prev   Next
EtherNet/IP Modbus TCP Implementation Guide     Programming Application - Controlled Start and Stop