How to Use PLC Timer Functions to Turn an LED On/Off

How to Use PLC Timer Functions to Turn an LED On/Off

This tutorial shows you how to use Timer Functions to turn an LED Light on and off using an HMI+PLC combo and displaying on the user-interface.

Software Required

Hardware Required

HMC4070A-M – Other HMC2000/HMC4000 models can also be used

Refer to the Digital Output Tutorial Pages to see the wiring diagrams for turning the digital output on and off for an LED light.

HMI + PLC Combo

TON (On Timer)

Software Code (Ladder Diagram)

Operands

Logic Block Expression

The timer starts on a rising pulse of IN input. It stops when the elapsed time is equal to the programmed time. A falling pulse of IN input resets the timer to 0. The output signal is set to TRUE when programmed time is elapsed, and reset to FALSE when the input command falls. Timer register depends on base. Base will be changed to 1ms.

Logic Block Example

OFF

ON After 5 Seconds

Software Code (Structured Text)

Another type of IEC Language you can use:

User-Interface Screenshot

When the toggle bit is pressed, it will turn the LED on AFTER 5 seconds.

It will turn it off immediately with another press of the toggle button.

TOF (Off Timer)

Software Code (Ladder Diagram)

Operands

Time Diagram

Logic Block Expression

The timer starts on a falling pulse of IN input. It stops when the elapsed time is equal to the programmed time. A rising pulse of IN input resets the timer to 0. The output signal is set to TRUE on when the IN input rises to TRUE, reset to FALSE when programmed time is elapsed.

Logic Block Example

ON

OFF After 5 Seconds

Software Code (Structured Text)

Another type of IEC Language you can use:

User-Interface Screenshot

When the toggle bit is pressed, it will turn the LED on immediately.

When the toggle bit is pressed again, it will turn the LED off AFTER 5 seconds.

TON (On Timer) + TOF (Off Timer)

Software Code

Refer to the TON (On Timer) and (TOF Off Timer) Sections for the Operands and Time Diagrams

Logic Block Expression

OFF After 5 Seconds

Logic Block Example

ON After 5 Seconds

OFF After 5 Seconds

Software Code (Structured Text)

Another type of IEC Language you can use:

User-Interface Screenshot

When the toggle bit is pressed, it will turn the LED on AFTER 5 seconds.

When the toggle bit is pressed again, it will turn the LED off AFTER 5 seconds.

TOFR (Off Timer with Reset)

Software Code

Refer to the TON (On Timer) and (TOF Off Timer) Sections for the Operands and Time Diagrams

Logic Block Expression

Logic Block Example

ON

OFF After 5 Seconds

Software Code (Structured Text)

Another type of IEC Language you can use:

User-Interface Screenshot

When the toggle bit is pressed, it will turn the LED on immediately.

When the toggle bit is pressed again, it will turn the LED off AFTER 5 seconds.

When the Reset momentary bit is pressed, the timer turns off. The state is whatever was last pressed.

Sample Project

The project shown above was designed for the specific hardware mentioned at the beginning of the tutorial and is intended to provide you guidance when programming your unit. If you are using models other than the ones specified in this sample project, similar steps can be duplicated within your own project.

Download MAPware sample project

Resources & Documentation

HMC/MAPware-7000 Resources

More

See our Support Center for a complete list of Quick Start and Installation Guides

Scroll to Top