One Line Programming Method White Paper
By Doug Hylton www.dwhylton.com 01/16/2009
One Line programming is a method of writing PLC ladder logic restricted to one line. Unlike conventional ladder programming where there is virtually an unlimited number of possibilities this form of programming acts as a limitation and makes the logic conform to a small number of specific patterns that can be learned in a short time. This concept lends to a program design that consists of a number of small blocks of logic apposed to a lesser number of large complex networks. The One Line programming method will force you to write good compact code that works. One Line programming can be used on any PLC that has the "NOT" instruction. PLC ladder programs written using the One Line method are easer to trouble shoot and maintain.
One Line method The logic is restricted to eleven instructions (using the Mitsubishi PLC) on one line.
Warning The One Line Programming examples below are not for the timid or faint of heart. The examples show how to build the primary blocks of logic that is at the heart of every PLC ladder program. You will see the "Not", the "Jump" and magic. If you are not prepared to think about the PLC as a computer opposed to a relay box then please hit your browsers BACK button NOW.
Basic Logic The first step in designing a program is to identity and understand the primary blocks of of logic that will be used in the program.
Simple latch using a branch instruction This is the basic one-bit latch that is used often in most every PLC ladder program.M1 is the set signal and M2 is the reset. This is used in many variations but the basic principle stays the same it takes two lines.

The same Simple latch using the One Line method M1 is the set signal and M2 is the reset. In the normal state the logic to the "Not" is true and inverted to false. When M1 comes on logic to the not is false and inverted to true setting Y0 and latching through Y0. Notice Its on one line.
![]()
Ten signal "OR" logic Notice how much space this network needs? You can only display one or two of these puppies on your screen. When trouble shooting you do a lot of scrolling. Using conventional ladder programming its possible to develop a large block of logic with multiple branches that is totally incomprehensible. This one takes ten lines.

The Same ten signal "OR" logic using the One Line method. Your computer monitor can display ten or twelve of these on one page and you can watch them all when trouble shooting. With One Line programming you can do any thing you want with the eleven instructions on one line no branches. It takes one line.
![]()
Ratchet relay There are a lot of ways to do a ratchet relay and some PLC have a built in feature that does a ratchet relay. X 001 is the signal and M10 is the output. Each time X001 comes on the output M10 changes state.
Yes the Mitsubishi has the Alt instruction that does the same thing this is just for fun. The output line with one normally closed contact would osculate on for one scan and off the next without the jump. The jump is active so the output rung is not being scanned and the out put stays in the last state.
At this point you need to accept the "NOT" or invert instruction and the "JUMP" instructions as valid instructions that can be used just like any other tool in your tool box.

Six station shift register I love this kind of logic because its so clean. Look at how the jump is used. You can easily customize this shift register to any number of stations you need. I learned the use of the jump junction from programming the old Texas Instruments 5TI PLC back in the seventies. Yes most PLC's provide a black box type shift register and sometimes that's the way to go but the roll-your-own shift register can be custom built for your job and with a custom made shift register the stations do not have to be consecutive numbered bits.
| M1 through M6 are the stations. | |
| M19 is the reset signal | |
| M20 is the shift pulse | |
| X1 is data input |

Six station ring counter. The ring counter is a shift register with both ends connected. It starts with the first station on and with each shit pulse moves through the stations..
| M1 through M6 are the stations. | |
| M19 is the reset signal | |
| M20 is the shift pulse |

It might appear difficult to limit ladder logic code to one line and eleven instructions per line but once you try it you will find its very easy. The problem with conventional ladder logic is there are too many possibilities and no standards. Its possible it create huge networks that are difficult to understand and this is false job security because after a few months even the author will find their own complex networks confusing. I suggest you try the one line technique on your next project.
Doug Hylton