LADDER LOGIC Chapter 1 Ladder logic is used in multi-million dollar CNC machine tools (Computer Numerical Control). It is used to program programmable controllers, such as manufactured by Allen Bradley and others. Ladder logic can be used in elevator controls and in many other applications.\par \par Programmable controllers have replaced relay logic in many situations, such as machine tools found in machine shops and factories. Relay contacts get dirty and burnt by electrical arciing. But the programmable controllers that replace relay logic use bits in memory to replace relays. Bits in memory that last a lot longer. \par \par Ladder logic provides a common language for engineers that design machines and program them and maintenance people who are out in the field troubleshooting and repairing those machines. \par \par Before computer numerical control machine tools were just NC machine tools (Numerical Control). One of the pioneers in NC machine tools was Pratt & Whitney. An engineer there had an idea for a machine that would produce parts more efficiently, and more automatically. The program for the part being made by the machine from a piece of steel would be on a punched paper tape that would tell the machine where the holes were to be drilled and tapped, and where slots were to be machined.\par \par Later the paper tape was replaced by more durable mylar tape. Then programs were seen on floppy disks. Now we have DNC, where the program is downloaded from a master computer to individual CNC machine tools when it's time to start making a different part than was being made by that machine tool.\par \par An NC milling machine would do the work of ten conventional (non-NC) milling machines. \par \par That engineer at P & W knew a lot about hydraulics. Hydraulic pilot valves can be used to control other mechanisms. But then someone showed him what a transistor was. Electronics was a better way to control such a machine.\par \par One of the early P & W NC machine tools had circuit boards that had two nor gates (more later about gates) on the printed circuit board. Gates consisting of a transistor and some resistors. But now we have logic chips (integrated circuits) that put multiple gates on a very small chip.\par \par NC machine tools from other vendors (such as Giddings & Lewis) were controlled by relay logic. You would have a machine tool with a control cabinet containing perhaps 200 relays to do logic funtions. Now we have a better way--ladder logic programs implemented in computer circuitry that replace most of those relays.\par \par When you look at a ladder logic diagram (see fig. 1), it looks like older relay logic diagrams, and has about the same functionality, except that the newer, solid state equipment will operate at faster speeds. A relay is a physical device that takes time to close or open. Transistors switch at about the speed of light.\par \par But as used in programmable controllers and CNC machine tools, the circuit symbols used in the diagrams for relay coils and relay contacts are not part of actual, physical relays, mostly, except when the relay represented is an actual output device that applies voltage to an external device.\par \par Otherwise, those circuit symbols are in memory rather than in actual physical devices. That is, a bit in memory is set or cleared (is a binary 1 or a binary 0) to represent a relay in a state of either energized or deenergized.\par \par A relay is an electromechanical device (see fig. 2) with a coil, an armature, and stationary contacts. The armature has moving contacts that move when the armature is pulled toward the coil by the magnetic field created by electrical current flow through the coil. When that current flow stops, the armature is pulled by a spring back to the deenergized position. \par \par Relays have two kinds of contacts: normally open, and normally closed. The normally open contacts are represented schematically by two parallel, vertical lines (fig.3), while the normally closed contacts are represented by the same, except with a slant crossing the two vertical lines.\par \par Normally closed contacts are closed while the relay is deenergized, that is, no current is flowing through the relay coil. But when the relay is energized with current flowing in the coil, then the normally closed contacts open, breaking the circuit connected to them, just as a circuit breaker opens the circuit connected to it when it trips because of too much current.\par \par Normally open contacts are open until the relay energizes, and close, completing a circuit when the relay is energized. Completing a circuit, that is, if other sets of contacts that may be connected "in series" with them are all closed. \par \par Let's consider a rather elementary electrical device, a flashlight that might be found in the home or car. Fig. x shows that a flashlight has three circuit components, plus electrical conductors to connect them together. You have the batteries, the light bulb, and the on/off switch. \par \par For proper operation, the lamp must agree in voltage requirements with the total voltage of the batteries. Batteries connected in series simply add their voltages, thus two 1.5 volt batteries total 3 volts. \par \par The light does not come out of the flashlight until the switch is turned on. But an electrician could replace the switch with a set of normally open relay contacts. Then when something causes the relay coil to energize, the flashlight will produce light. Thus the normally open relay contacts function as a switch would to close or open the flashlight circuit.\par \par But what if two switches were connected in series, just as the two batteries were connected in series? Fig. x shows a series connection and a parallel connection. You can connect resistors in series or in parallel. You can connect relay contacts in series or in parallel. You can connect batteries in series, or in parallel (but usually, we only connect batteries in series.)\par \par When two switches are connected in series, then both must be closed to complete the circuit (otherwise, no light from the flashlight). Or, if three, or four, or twenty switches are in series, all must be closed ("on") to complete the circuit.\par \par But if switches are connected in parallel, then any one of those switches completes the circuit.\par \par Of course, we can also have combinations of switches (or relay contacts) in series/parallel as in fig. x.\par \par Contacts connected in series are said to be an "and" function. Contacts connected in parallel are said to be an "or" funtion.\par \par The and function simply means all switches in series must be closed to complete the circuit. The or function means either this switch or that switch or the other switch connected in parallel will complete the circuit.\par \par The word "circuit" has the same root word as circle, or circumference. Electrical apparatus operates only when there is a complete circuit, as we have when the flashlight is turned on, or the TV is turned on, or the radio, etc. The current flows out of one terminal of the power source, through the circuit, and back to the other terminal source.\par \par Contacts in series are called an "and" function, while contacts in parallel are said to be an "or" function. These are called logic functions, as in "Boolean Logic," apparently invented by Mr. Boole. \par \par Logic functions are also available in the form of integrated circuits, or "chips." One family of logic devices is the TTL 7400 series of chips using the older bipolar, junction transistors. A newer kind of transistor is the field effect transistor, from which we get the CMOS logic chips. (Complementary Metal Oxide Semiconductor.) TTL is transistor-transistor logic. \par \par With those logic chips, you can have your and gates and your or gates. An and gate must have all inputs true, or high, or binary 1 for the output to be true. An or gate need have only one input true for the output to be true.\par \par Computers are composed of large numbers of these logic chips with their logic gates. But another key ingredient of computers is the software that tells them what to do. The software is the program or programs that the computer executes, such as the operating system, or the application programs. A popular operating system now is Windows, but some computers use the Linux operating system. \par \par Ladder logic is a kind of program understandable by both design engineers and maintenance people who troubleshoot and repair \par the machines controlled by the ladder logic program.\par \par \par Chapter 2.\par \par Now let's program a programmable controller using ladder logic to control the traffic lights at the intersection of Ash and Willow streets (fig. x). As you can see, Ash is the north/south street, and Willow is the one going east/west. Approaching the intersection, it is posted "No Left Turn" for each of three directions. The only left turns are allowed when the green left turn arrow light comes on for vehicles approaching the intersection from the South, Northbound on Ash. \par \par If you think there ought to be more left turns allowed, you can contact the mayor and/or city council, but for now we're stuck with this. Also, it makes our first ladder logic program a little simpler. \par \par Chapter 3.\par \par Let us consider a very simple elevator. Later, we'll have a more complicated elevator.\par \par \par About the Author.\par \par Frederick E. Hoehn holds his General Radiotelephone Operator's License from the Federal Communications Commission, and is a Distinguished Graduate of military technical schools. He studied engineering at Los Angeles Valley College, and at the University of California, Berkeley. He is a former TV and radio station engineer. He is a digital hardware engineer, designing electronic circuitry, and a software engineer. He was Instructor at a U.S. Army computer school at Ft. Bliss, TX. He is also an author of non-technical books, and father of two children.\f1\fs22\par }