⚙️

Siemens S7-1200 PLC and Incremental Encoders

Apr 7, 2025

Using Siemens S7-1200 PLC for Incremental Encoder Reading

Introduction

  • Discussing the use of Siemens S7-1200 PLC to read sensors/incremental encoders.
  • Applications include speed measurement, distance measurement, and systems like packaging machines and conveyors.

Incremental Encoder Basics

  • Encoders provide pulses per revolution (e.g., 100, 1,000 pulses).
  • Typical industry resolutions range from 200 to 4,000 lines per revolution.
  • An A/B channel configuration provides directionality:
    • A leading B indicates forward movement.
    • B leading A indicates reverse movement.
  • Quadrature output: Each pulse can be counted four times for higher resolution.

Application Example

  • Reference application example number: 10 97423 46.
  • Contains three examples for speed and distance counting.
  • Key focus: Implementing high-speed counters (HSC) in S7-1200.

Hardware Setup

  • CPU model: S7-1200, specifically CPU 1211.
  • Using inputs A (0.0) and B (0.1) for incremental encoder connection.
  • Incremental encoder specifications: 124 lines/revolution mounted on a DC motor shaft.
  • Motor speed: approximately 150 RPM, expected output of 1 revolution per second.

Configuring the PLC

  • Use TI Portal to configure the S7-1200 PLC.
  • HSC resources: 6 high-speed counters available, with a maximum frequency of 100kHz.
  • Hardware settings: Enable HSC and select appropriate counting modes (e.g., A/B counter).
  • Event configuration: Set up reference values for triggering events based on counter values.

Programming Overview

  • Use OB1 for basic logic development.
  • Moving the counter value from ID 1000 to an internal variable, e.g., MD 1000.
  • Use structure for the HSC logic to manage counting and direction.
  • Explanation of CV (Current Value) and RV (Reference Value).

Testing and Validation

  • After setup, start the PLC and manually rotate the motor.
  • Monitor the input channels (0.0 and 0.1) for activity.
  • Verify that the counter is counting properly and matches expected rotations.

Conclusion and Next Steps

  • Summarized how to read incremental encoder values using S7-1200.
  • Future video: Implementing calculations to convert counter values to speed (RPM).
  • Encouraged viewers to subscribe for additional content.