LadderLogicOnline

Learn › Instructions

XIC and XIO: Examine If Closed and Examine If Open

XIC and XIO are the contacts of ladder logic. XIC passes power when its bit is on; XIO passes power when its bit is off. Simple as that sounds, the names trip up nearly every beginner, so let's get them straight.

XIC: Examine If Closed

XIC, drawn ] [, looks at one bit. If the bit is 1 (on), the contact passes power to whatever is to its right. If the bit is 0 (off), it blocks power.

 |   Photo_Eye                              Counter_Input |
 |------] [--------------------------------( )-----------|
XIC: the output follows the photo eye. Eye blocked, output on.

The name comes from relay days: "examine the input; if the circuit is closed, pass power." It's often called a normally open contact, because a relay's normally open contact closes (passes current) when the relay is energized.

XIO: Examine If Open

XIO, drawn ]/[, is the opposite. It passes power when its bit is 0 and blocks power when its bit is 1. It's often called a normally closed contact.

 |   Tank_Full                              Fill_Pump |
 |------]/[--------------------------------( )-------|
XIO: the pump runs while the tank is NOT full.
Bit valueXIC ] [XIO ]/[
0 (off)Blocks power (false)Passes power (true)
1 (on)Passes power (true)Blocks power (false)

The contact examines a bit, not a wire

Here is the idea that clears up most confusion: XIC and XIO describe what the instruction checks for in memory, not how the field device is wired. The PLC never knows whether a button is a normally open or normally closed device. It only sees the input bit as 1 or 0.

That's why a stop button can be programmed with either contact, depending on the hardware:

Real machines use normally closed stop buttons because a broken wire then looks like a pressed stop and the machine stops safely. Many programmers find "XIC on a stop button" strange at first, but it follows directly from the rule: XIC means "true when the bit is on", and a healthy normally closed stop circuit keeps the bit on.

The Playground's push buttons can be set to Normally open (on while pressed) or Normally closed (off while pressed) in the part's properties. The conveyor starter program uses a normally open Stop button with XIO Stop. Switch the button to normally closed and you'll need XIC Stop instead. Try both.

What a contact can read

A contact reads any bit:

Reading an output's own tag is common and perfectly fine. A contact on Motor next to the start button is the seal-in that keeps a motor running after the button is released. That pattern has its own tutorial.

You can use as many contacts on the same tag as you like, anywhere in the program. Unlike coils, reading a tag many times never causes conflicts.

Where contacts go

Contacts are input instructions: they go in the condition part of a rung, anywhere before the last column. Put them in series for AND, on parallel branches for OR (see AND, OR and NOT). The last column of a rung is for outputs, so a contact can't go there.

In the Playground, press 1 for XIC or 2 for XIO with a spot selected, or drag them from the toolbar. Double-click an existing contact and type over it to swap XIC for XIO without rebuilding the rung, or press F2 to change its tag. While the program is running, clicking a contact toggles its tag, which is a handy way to test logic without the simulator.

Try it in the Playground

  1. Open the Playground with the conveyor starter program.
  2. Run it, press Start, then press Stop. The XIO Stop contact opens the rung while Stop is held.
  3. Stop the program. Click the Stop push button in the simulator and change its contact to Normally closed. Run again: the conveyor won't start, because Stop is now on when it isn't pressed and XIO Stop blocks the rung.
  4. Double-click XIO Stop, type XIC, and run once more. Start and Stop work again, now with fail-safe wiring.

Common mistakes