circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

Issue 140 March 2002
Replacing Relays with Ladder Logic
Part 1: Getting Ready for the Climb

 


by Fred Eady

Fred’s reaching for the sky with his latest project so it’s no surprise that ladder logic came into play. With a well-balanced programmable logic controller board, Fred observed the “Do not disturb” labels on the board and tried figuring out the hardware via the software.


Start What's Fred Up To? Inside The Hardware Climbing The Ladder Top Of The LadderSources & PDF

Ladder logic. That sounds like something painters and window washers would use and be good at. On the other hand, my plumber friend and his father both fell off the same ladder performing the same plumbing task at the same house with the ladder in the same position for each of their falls. If you were to poll me on who’s who of ladder logic, I’d say the couple of plumbers I know are definitely not experts at it.

Ladder logic came along in the fabulous 1960s and matured with the great music my teenagers think was written by contemporary rap artists. Unlike the rappers, ladder logic is an original and didn’t have much except relay coils to take anything from. In fact, I’d wager that some of our most popular micros took some pointers from the beginnings of automated industrial control in which ladder logic was a key player.

Ladder logic’s climb to popularity originated in Motown as auto manufacturers were trying to find a suitable replacement for the relay-based automation found on their assembly lines. Out went the relays and in came the Programmable Logic Controller (PLC), and right there with it was a newfangled programming lingo called ladder logic.

The new programming language adopted some of the old relay logic lingo. Ladder logic programs are full of relays, coils, and contacts. Some of these relay components are real and many more of them are logical, or, for a better word, virtual, as they only exist in the mind of the PLC.

As I studied example ladder logic programs and experimented with my own ladder logic creations, I realized that the relay coils and contacts in my programs were the bits that control the behavior of my embedded programs. Taking the analogy a bit further, the ladder logic inputs and outputs perform the same functions as I/O pins on microcontrollers. With the inclusion of timer coils, counter coils, and sequencers, ladder logic is to PLCs what C is to microcontrollers with one major difference. The microcontroller behind a ladder logic program is on steroids and a daily regimen of BowFlex strength training.