Skip to content
Home » Blog » MELSEC Tutorial 06 – Ladders Timers and Counters

MELSEC Tutorial 06 – Ladders Timers and Counters

MELSEC Tutorial 06 – Ladder Logic Programming: Timer and Counter

MELSEC Timers and counters are fundamental tools in ladder logic programming, enabling precise control over time-dependent and count-dependent operations. In this tutorial, we’ll explore how to implement and use timers and counters with MELSEC PLCs using the GX Works3 software. These instructions are vital for tasks such as delaying actions, sequencing operations, and tracking repetitive events in automation systems.


YouTube player


Introduction to MELSEC Timers and Counters in Ladder Logic

Timers:

Timers allow processes to be delayed or controlled based on time intervals. They are used in operations like turning off a motor after a specific duration or pausing between steps in a sequence.

Common types of timers in MELSEC PLCs include:

  1. On-Delay Timer (TON): Delays the activation of an output.
  2. Off-Delay Timer (TOF): Delays the deactivation of an output.
  3. Pulse Timer (TP): Generates a pulse for a defined period.

Counters:

Counters track events or cycles, such as counting parts on a conveyor or cycles in a machine operation.

Types of counters include:

  1. Up Counter (CTU): Counts upward from zero to a preset value.
  2. Down Counter (CTD): Counts downward from a preset value to zero.
  3. Up/Down Counter (CTUD): Tracks both upward and downward counts.

Step 1: Setting Up Your Project in GX Works3

Before using MELSEC timers and counters, ensure your environment is prepared:

  1. Open GX Works3 and create a new project for your MELSEC PLC.
  2. Define the I/O mapping to match your hardware.
  3. Verify that the GX Works3 simulator is functional if you intend to test virtually.

Step 2: Implementing Timers in Ladder Logic

Example 1: On-Delay Timer (TON)

An on-delay timer delays an output’s activation by a specified time.

Scenario: Start a motor 5 seconds after a start button is pressed.

  1. Insert a TON instruction into the ladder logic editor.
  2. Assign the timer a unique address (e.g., T0).
  3. Set the preset time to 5 seconds (K50, representing 0.1-second increments).
  4. Use the timer’s completion signal to activate the motor.

Ladder Logic Code:

Start Button --] [-- TON (T0, K50) -- Motor Output --( )--

Example 2: Pulse Timer (TP)

A pulse timer generates a pulse for a defined duration.

Scenario: Activate a buzzer for 3 seconds when an alarm condition is triggered.

  1. Insert a TP instruction and assign it an address (e.g., T1).
  2. Set the preset time to 3 seconds (K30).
  3. Use the timer’s output signal to control the buzzer.

Ladder Logic Code:

Alarm Condition --] [-- TP (T1, K30) -- Buzzer Output --( )--

Step 3: Implementing Counters in Ladder Logic

Example 1: Up Counter (CTU)

An up counter increments each time a specified event occurs.

Scenario: Count parts on a conveyor until 10 items are detected.

  1. Insert a CTU instruction and assign it an address (e.g., C0).
  2. Set the preset count to 10.
  3. Use the counter’s completion signal to trigger the next action.

Ladder Logic Code:

Sensor Detect --] [-- CTU (C0, K10) -- Output Signal --( )--

Example 2: Up/Down Counter (CTUD)

An up/down counter increments or decrements based on specific inputs.

Scenario: Track the number of items entering and exiting a storage bin.

  1. Use the up input to count items entering and the down input for items exiting.
  2. Monitor the current count to ensure the storage bin doesn’t exceed capacity.

Ladder Logic Code:

Item Enter --] [-- Up (CTUD) -- Bin Full Output --( )--  
Item Exit --] [-- Down (CTUD)


Step 4: Testing Timers and Counters

Using the GX Works3 Simulator:

  1. Simulate your ladder logic program to test timer and counter functionality.
  2. Observe the T bits and C bits to verify activation and completion signals.
  3. Adjust preset times or counts if the results don’t meet expectations.

Conclusion

Ladder logic diagram demonstrating timer and counter usage for an industrial automation process using MELSEC PLC.

Timers and counters are indispensable for creating time-dependent and event-driven logic in MELSEC PLCs. By following this tutorial, you can confidently design ladder logic programs with these tools to enhance the functionality and efficiency of your automation systems. Mastering these instructions will significantly improve your programming skills and enable you to tackle complex control challenges.

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
100% Free SEO Tools - Tool Kits PRO