standard has been adopted for ladder programming and indeed all the methods This chapter is an introduction to the programming of a PLC using ladder. Ch 2 Ladder Basics. 1. Chapter 2. Ladder Basics. Understanding Electrical Ladder Drawings. Before discussing or understanding the Programmable Logic. Typically in industrial relay logic circuits, but not always, the operating voltage for the Ladder diagrams (sometimes called "ladder logic") are a type of electrical.
|Language:||English, Spanish, Japanese|
|Genre:||Children & Youth|
|Distribution:||Free* [*Register to download]|
Outline. ❑ Introduction to Programming Software. ❑ Ladder Diagram. ❑ Basic Logic Functions. ❑ Mnuemonic Code. ❑ CX-Programmer. Ladder Logic. Learning objectives. ▫ Understand basic ladder logic symbol. ▫ Write ladder logic for simple applications. ▫ Translate relay ladder logic into PLC . The First Programmable Logic. Controllers (PLCs). • Introduced in the late 's. • Developed to offer the same functionality as the existing relay logic systems.
This is a trivial example, but it should be clear that the language is quite expressive. Ladder logic is not a general-purpose programming language, but it is Turing-complete, accepted in industry, and, for a limited class of mostly control-oriented problems, surprisingly convenient. They therefore provide more than enough MIPS to run reasonably complex ladder logic with a cycle time of a few milliseconds.
I think PLCs usually have some sort of runtime that's kind of like an interpreter or a virtual machine, but if we're doing simple logic on a processor without much memory then a compiler might be a better idea.
So I wrote a compiler. You start with an empty rung. You can add contacts inputs and coils outputs and more complicated structures to build up your program. There are counters and arithmetic operations plus, minus, times, div. Circuit elements may be added in series or in parallel with existing elements.
You can have internal relays Rfoo , for which memory is automatically allocated, or inputs Xfoo and outputs Yfoo , to which you must assign a pin on the microcontroller. The selection of pins available depends on the microcontroller. You can edit the program in graphical form: Then you can test the program by simulating it in real time.
The program appears on screen with the energized true branches highlighted, which makes it easy to debug. The code generator isn't all that difficult. If you realize that a parallel circuit is an OR and a series circuit is an AND, it's a second-year CS assignment, and not a very long one. The editor is actually much more challenging. It would take some work to make a smart compiler, though.
For the AVR a good register allocator would provide a major speedup. If you wanted to get very fancy then you could apply standard logic reduction algorithms, and maybe state reduction too.
That would be much more difficult. The timers screw things up anyways. Even ignoring all that, my code generator for the AVR is very poor.
Some of the code that it generates is just embarrassingly bad. The PIC back end is better, but not really great. None of this matters much until you're trying to run dozens of rungs of logic with fast cycle times.
That means that you can write ladder logic that reads analog inputs, and that sends and receives characters over serial for example to a PC, if you add a suitable level-shifter like a MAX, or to a character LCD.
It is possible to send arbitrary strings over serial, as well as the values of integer variables, as ASCII text. Limitations, and Disclaimer Of course a microcontroller with this software can't do everything that a PLC will.
Most PLC environments offer more features and predefined blocks than my tool does. The PLC hardware is better too; usually the inputs and outputs are designed to withstand incredible electrical abuse. So far I have received very few bug reports compared to the number of people with questions or feature requests.
There is still great possibility for defects, especially in the targets for microcontrollers that I do not physically have and therefore cannot test.
Certainly do not use LDmicro for anything safety-critical, or anything that would break something expensive if it failed. The Compare instruction will evaluate if the two values are:. If the evaluation condition is met, then the result will be true, passing the logic path along to the next instruction or turning the rung output ON. So, how can we use the Compare contact in an application? Imagine having a freezer full of frozen fish. The key word there is frozen! The PLC is programmed to take the analog signal and convert it into degrees Fahrenheit.
If the temperature reads greater than 32 degrees, we can sound an alarm horn to alert us that the frozen fish will soon thaw and spoil. Using the Compare contact instruction dialog box, as seen below, we can compare our actual Freezer Temperature stored in memory location DF16 to the constant 32, which represents 32 degrees Fahrenheit. The Compare contact dialog box allows us to select any of the six different comparison methods.
For this example, we have selected Greater Than so that if our Freezer Temperature ever becomes Greater Than the number 32, our Compare contact will become true. An Out coil is then programmed from our Compare contact, as seen below, and will provide the signal that is wired to the external Alarm Horn, which alerts us to a problem with our freezer and hopefully giving us time to avoid disaster.
Ladder Logic is the most widely used programming language in industrial automation today. Its ease of use, traceability, and visual representation of physical components make it the favored programming method of many engineers. If you are new to PLC programming and would like to try Ladder Logic for yourself, download any of our programming software packages mentioned below for free and see what you think. After all, experience is the best teacher.