Xiamen Lisen Trading Co., Ltd

Omron CP1H Programming Examples: A Complete Guide for Beginners

The Omron CP1H is a high-performance compact PLC widely used in industrial automation, offering versatile I/O options, fast processing, and robust communication capabilities. Programmers and automation engineers often search for reliable Omron CP1H programming examples to streamline their development process, troubleshoot issues, or learn best practices. This comprehensive guide delivers practical ladder logic examples, real-world application snippets, and proven techniques that will help both beginners and experienced engineers master CP1H programming using CX-Programmer software.

Whether you are controlling conveyors, packaging machinery, or HVAC systems, the CP1H series supports a wide range of instructions, including timers, counters, math operations, data manipulation, and analog signal handling. Below, we break down essential programming examples with clear explanations and structured syntax references.

Getting Started with CX-Programmer for CP1H

Before diving into programming examples, ensure you have the correct software environment configured. The CP1H is programmed using Omron CX-Programmer (version 9.5 or later is recommended for full feature support). The software allows you to create ladder diagrams, structured text, and function block programs that can be uploaded to the PLC via USB, serial, or Ethernet connections.

  • Connect the CP1H to your PC using a USB cable or CP1W-CIF01 Ethernet option board.
  • Set the correct PLC model in CX-Programmer: CP1H-X / CP1H-Y / CP1H-XA.
  • Configure the communication settings under PLC > Transfer Setup.
  • Test the connection using the Online > Work Online option.

Basic Ladder Logic Programming Examples

The foundation of PLC programming in Omron systems is ladder logic. The following examples illustrate fundamental operations using the CP1H’s standard input and output addresses.

Example 1: Simple Start/Stop Motor Control

This classic example demonstrates a motor start/stop circuit using two pushbuttons and a holding contact.

  • 0.00 – Start Pushbutton (NO contact)
  • 0.01 – Stop Pushbutton (NC contact)
  • 100.00 – Motor Output Coil
  • 100.00 – Holding (Sealing) Contact

The rung logic: when the Start button is pressed, current flows through the normally-closed Stop contact, energizing output 100.00. The output’s own contact (100.00) then closes in parallel with the Start button, maintaining the circuit after the button is released—commonly known as a seal-in circuit.

Example 2: Using the TIM Instruction (On-Delay Timer)

Timers are essential for delayed operations. The CP1H supports on-delay (TIM) and off-delay (TIMH) timers with 100ms and 10ms time bases respectively.

ComponentAddress / ValueDescription
Timer NumberT0000On-delay timer 0
Set Value (SV)#00505 seconds (50 × 100ms)
Input Contact0.02Start condition
Output100.01Delayed output

When input 0.02 turns ON, the timer T0000 begins counting. Once the present value (PV) reaches the set value (SV) of 50, the timer’s contact closes, energizing output 100.01. This is ideal for applications like conveyor sequencing or pump startup delays.

Counter Programming Examples

Counters in the CP1H track the number of input pulses and trigger actions when a predefined count is reached. The most common instructions are CNT (counter) and CNTR (reversible counter).

Example 3: Product Counting with CNT Instruction

  1. Connect a photoelectric sensor to input 0.03 to detect products on a conveyor.
  2. Use a CNT instruction (C0001) to count up to a set value of 20.
  3. When the count reaches 20, output 100.02 energizes to activate a diverter or packaging mechanism.
  4. Reset the counter using a separate reset input connected to 0.04.

Data Comparison and Math Operations

The CP1H supports a wide range of comparison and arithmetic instructions that allow conditional logic based on real-time data. This is particularly useful for analog sensor monitoring and recipe-based control.

Example 4: Temperature Monitoring with CMP Instruction

Using the CMP (Compare) instruction, you can monitor an analog temperature value stored in D0000 and trigger alarms or cooling fans when thresholds are exceeded.

  • D0000 – Stores the current temperature value (scaled to engineering units).
  • CMP(020) D0000 #750 – Compares D0000 with constant 75.0°C.
  • If D0000 > 750, the GT (greater than) flag becomes active.
  • Use the GT flag to energize output 100.03 (cooling fan ON).

High-Speed Counter and Pulse Output

The CP1H’s built-in high-speed counter inputs can process frequencies up to 100 kHz, making it ideal for encoder feedback and motion control applications. The CP1H-XA models also support pulse output for stepper motor and servo control.

Typical setup steps include:

  1. In the PLC Settings dialog, enable the high-speed counter on inputs 0.08 and 0.09.
  2. Set the counter mode to Linear Counter or Ring Counter based on your application.
  3. Use the PRV (Read High-Speed Counter PV) instruction to read the current count into a data register.
  4. Use the PULS and SPED instructions to generate fixed-pulse outputs for motor positioning.

⚠️ Pro Tip / Warning: When using high-speed counters, always configure the PLC Settings in CX-Programmer before writing your ladder logic. The high-speed counter allocation is hardware-defined, and changing input assignments after programming can cause unexpected behavior. Additionally, ensure that encoder signals use shielded cables to avoid electromagnetic interference in industrial environments.

Communication and Networking Examples

The CP1H supports multiple communication protocols including Modbus RTU, Host Link, and Ethernet/IP (with optional CIF41/CIF21 modules). Programming examples for serial communication typically use the TXD and RXD instructions.

Example 5: Modbus RTU Master Communication

Leave a Reply

Your email address will not be published. Required fields are marked *