⚙️

Siemens S7-1200 PLC and Encoders Overview

Apr 7, 2025

Notes on Using Siemens S7-1200 PLC with Incremental Encoders

Introduction

  • Discussion on using Siemens S7-1200 PLC to read sensors/incremental encoders.
  • Application examples in packaging machines, conveyors, and speed/distance measurement systems.

Incremental Encoders

  • Definition: A device that generates pulses for each revolution (e.g., 1000 pulses per revolution).
  • Resolution: Commonly ranges from 200 to 4000 lines per revolution.
  • Channels: Typically has two output channels (A and B) used to determine direction of rotation.
    • If A leads B, the direction is forward.
    • If B leads A, the direction is reverse.
  • Quadrature Output: Allows for counting in higher resolution (4 pulses for every single pulse).

Setting Up the PLC

  • Controller: Using CPU 1211 of the S7-1200 series, which can handle 6 high-speed counter resources.
  • Configuration Steps:
    • Access the hardware properties and enable the HSC.
    • Select the counting mode (AB counter for incremental encoders).
    • Set initial count direction and limits (default values can usually be left as is).
  • Event Configuration: Allows for setting reference values to trigger outputs when certain counts are met.

Connecting the Incremental Encoder

  • Wiring: Connect channels A and B to inputs 0.0 and 0.1 respectively.
  • Input Filtering: Set appropriate filter times based on frequency (default may need adjustment).
    • Recommended input filter time for 100K Hz is below 0.8 microseconds.

Programming the PLC

  • Reading Counter Values: Use ID 1000 to read from the high-speed counter.
  • Memory Handling: Store values into internal memory for processing.
  • Example Logic:
    • Triggering outputs based on counter values.
    • Moving counter value to internal variables for calculations.

Using Function Blocks

  • HSC Function Block:
    • Used for switching the direction and handling comparison counting.
    • The direction can only be set through the hardware configuration, not programmatically.
  • Setting Pre-set Values:
    • Use a command to set the counter value to a specific pre-defined value.
    • Useful for retaining values across system restarts.

Conclusion

  • Basic overview of setting up and programming the S7-1200 PLC for reading incremental encoders.
  • Future video to focus on translating counter values into RPM and further calculations.