Programming Examples - Programmable Logic controllers

Consider a program that could be used to flash a light on and off as long as there is some output occurring. Thus we might have both timer 0 and timer 1 set to 1 s. When the output occurs, timer 0 starts and switches on after 1 s. This closes the timer 0 contacts and starts timer 1. This switches on after 1 s and, in doing so, switches off timer 0. In so doing, it switches off itself. The lamp is on only when timer 0 is on, and so we have a program to flash the lamp on and off as long as there is an output.

As an illustration of programming involving timers, consider the sequencing of traffic lights to give the sequence red only, red plus amber, green, and amber, then repeat. A simple system might just have the sequence triggered by time, with each of the possible states occurring in sequence for a fixed amount of time. Figure shows the sequential function chart and a possible ladder program to give the sequence.

As another illustration of the use of a timer, consider Figure which is a program to initially switch on motor 1 and its signal lamp 1, then after a time set by the timer to switch off motor 1 and signal lamp 1 and switch on motor 2 and signal lamp 2. When there is an input, the timer starts. Until the timer has timed out, the closed timer contacts remain closed and so motor 1 and lamp 1 are on; the open timer contacts remain open and so motor 2 and lamp 2 are off. When the timer has timed out, the closed timer contacts open and switch off motor 1 and lamp 1; the open timer contacts close and switch on motor 2 and lamp 2.

Figure shows an example of where a TON timer and a TOF timer are both used to control a motor. The first rung starts with a start switch that is latched by the TON timer so that the input to it remains on, even when the start switch is no longer activated. After the delay time of the TON timer the motor is started. The motor is stopped by input to the Stop input, but the motor continues running for a time delay set by the TOF timer before finally stopping.

Flashing light

Traffic light sequence

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Programmable Logic controllers Topics