CP2E-N30DR-D PLC Programming

This section covers the basic symbols and the first program for the PLC. For the hardware used or for the hardware setup, please see either the Hardware Selection or the Hardware Setup.

Note:

The I/O memory areas or addresses that are shown here are specific to the CX One program for use with Omron PLCs. I/O memory areas may differ between PLCs, please check the user manual for specific addresses.

Symbols Start_New_Program Setting I/O First Contact Addresses on the Fly Counter Setup Timer Setup Initiate Timer Counter Reset Setting Yellow Light Timer Naming Setting Alarm Inverting Contact Alarm Timer and Green Light One Shot Running Count Transfer to PLC Monitor to Edit

Symbols

Before the programming the PLC, below are the basic symbols for programming. Along with the symbols are the addresses or values, which can designate inputs, outputs, timers, counters and other specific instructions.

image


Normally Open Contact




image


Normally Closed Contact


image


Normally Open Coil



image


Normally Closed Coil


Below are the steps needed to program the PLC with the starting program.

Start_New_Program


After launching the CX Program, click on the blank page to start a new program. Enter the name of the project and select the PLC CP2E-N. This will automatically set the network type to Ethernet(FINS/TCP).

Setting I/O

Before the ladder logic is setup, the input and output addresses can be set. The above video shows the selection of the symbols in the side bar and right clicking on an open area to add addresses. The “Name” can not have any spaces. Spaces need to be replaced with “_” instead.

Below are the addresses that can be set at this point.

Name Data Type Address Comment
IxSensor Bool 0.00 Omron Sensor
Yellow_Light Bool 100.04 Tower Light Yellow
Green_Light Bool 100.05 Tower Light Green
Red_Light Bool 100.06 Tower Light Red
Alarm Bool 100.07 Alarm

With the base I/O set the program can start to take shape. As the contacts, coils and instruction blocks are placed symbols can be created on the fly.

First Contact

To place a contact, first select either the open or closed contact. Next place the contact in rung zero on the left side. Coils and other instructions are placed on the right of rungs.

Addresses on the Fly

For addresses that need to be entered, but are not determined at the start, they can be created on the fly and will be stored in the symbol library. Comments can be added in the symbol library.

Counter Setup

When a counter needs to be added, select the instruction icon and place it on the right side of the rung. When the type of counter needed is not known, click on the “Detail” and then “Find Instruction.” Next select “Timer/Counter” for the types of available and select “CNT”. The operands will need a address location, in this case “000” and a value to count, entered as “#10” entered on the next line. As the counter counts down to zero and a Count Completion Flag is initiated. This can be used as a contact in the work area by entering “C000” as an address.

Timer Setup

The setup of a timer is similar to the counter. Instead of selecting CNT, select “TIM” and enter into the operands “001” in the first line and “#3” in the second line. The number after the “#” indicates the amount of time in milliseconds, which for this timer is 100ms x 3 for 300ms. The second timer is set up the same except for the address is “002” instead. The timers also have a completion flag similar to the counter. These timer flags are “T001” and “T002”.

Initiate Timer

To initiate the first timer, the counter completion flag is used. Place a open contact in rung 3 for T001 using address “C000”, the counter flag contact. Next the counter will also initiate the red tower light, address “100.06”. There also needs to be a contact for the timer, “T001”, this will turn of the red tower light after 300ms.

Counter Reset

When the counter reaches zero, a completion flag will initiate. To reset the counter a contact need to be used. The counter will be reset when timer 001 sends it completion flag.

Place a open contact in rung zero inline with the remaining input on the counter. Use address “T001” for this contact.

Setting Yellow Light

When the sensor beam is not broken, the Yellow Light will stay on. To set this up first place two closed contacts in rung 1. The first contact will use address “W0.01” and the second will use “100.06”. Next place a coil with address “100.04” and connect the contacts with the coils.

Timer Naming


To be able to differentiate the timers for the alarm and red light, they can be named for which one they are used with. First double left click on the timer and then click OK. Enter “Red Light Hold” for timer 001 and “Alarm Hold” for timer 002.

Setting Alarm

When the counter completion flag initiates, the red light will turn on as will the alarm. To set this, first place a closed contact in rung 2 and use address “T002”. Next place an open contact with address “C000”, and another open contact below the counter contact using address “W0.00”. Then place a coil on the same line as the W0.00 contact, this coil will use address “100.07”. Finally place one more coil on the first line of the rung using address “W0.00”, this will latch the contact W0.00 on this rung.

Inverting Contact


The timer contact on rung three needs to be made a closed contact. Instead of deleting the contact and replacing it, the contact can be inverted. To do this right click on the contact and select “Invert (NOT)”, this will change the type of contact.

Alarm Timer and Green Light

First place a contact in same rung as the timer for “Alarm Hold”, this contact will use address “W0.00”. Connect this contact to the timer of the right side of the rung.

Next in rung five, place a closed contact and use address “100.04” for the Tower Light Yellow, next place another closed contact using address “100.06” for the Tower Light Red. Then on the right side of the rung place a coil for the Tower Light Green using address “100.05” and connect the contacts to the coil. Both contacts are used to make to green light turn on only when the count is less than 10.

One Shot

To keep track of the amount of breaks that the sensor has, a running total will be created. For this a DIFU will be used. First place the “Sensor_Input” contact in rung six and then place a new instruction on the right side. This instruction will need the type which will be “DIFU” and the address that this will be set to, “W0.02.” Next the running total can be set up.

Running Count

A running count will be set up to keep track of the total number a sensor beam breaks. Using the new address created for the one shot, “W0.02,” place a new contact in rung seven. Next place a new instruction. This instruction will use arithmetic to add one when the sensor is broken. To create the instruction type “+”, this is to call out addition, next enter “&1”, this is the amount to be added to the stored bit upon each activation. Next enter “D4 D4”, this will add one to the bit is address D4 and then store the new number in D4. The comment “Running Count” can be added to this instruction.

Transfer to PLC

To transfer the program to the PLC. First connect the PC to the network port of the PLC, next click the yellow triangle to connect to the PLC. Once connected, use CTRL+T to transfer the program to the PLC. Click “YES” on each prompt, when completed CX Programmer will be in Monitor Mode.

Monitor to Edit


When the program needs to be edited to make additions or changes, click on the yellow triangle or right click on the PLC Monitor Mode heading.