6.4 PLC Programming Fundamentals & HMI Systems

Key Takeaways

  • A ladder instruction tests data. The electrical contact may be physically open or closed while the logic evaluates the mapped bit.

  • Place an ordinary stop permissive in series with the entire start and hold branch. Safety-related stops require their own safety design.

  • Use the controller’s timer base, task schedule, I/O update and restart behavior when reasoning about timing.

  • Compare the controller data and the HMI tag. Check alarm threshold, deadband and displayed status when diagnosing a discrepancy.

Last updated: November 2026

Read the drawing and the program together

IEC 61131-3:2025 edition 4 defines Structured Text, Ladder Diagram and Function Block Diagram, with Sequential Function Chart elements for structuring programs and function blocks. Older controllers and documents can refer to Instruction List. This example uses Rockwell’s ladder instruction names. Always check the project’s platform and revision.

An XIC instruction evaluates true when its addressed bit is 1. An XIO evaluates true when its bit is 0. An OTE writes its addressed bit according to the rung result when executed. A physically normally closed contact can feed an XIC input bit. Electrical contact construction belongs on the wiring drawing, while the XIC instruction describes a test of the data. An OTL sets a bit on a true rung and OTU clears it. A false rung leaves the latched bit alone during ordinary execution. Check the platform’s startup, prescan and data retention behavior separately. Rockwell’s Logix instruction reference describes these instructions.

Worked ladder example

In this ordinary motor command example, the stop contact feeds the bit StopHealthy with 1 when closed, under the stated wiring and supply conditions. The start input supplies 1 while the start button is pressed. The rung implements this expression.

|--[XIC StopHealthy]--+--[XIC StartPB]--+--(OTE MotorCmd)--|
|                     |                 |                  |
|                     +--[XIC MotorCmd]-+                  |

The start and hold elements are parallel branches. The stop permissive is upstream of both. On a valid start, the rung sets MotorCmd. On the next execution the hold branch can sustain it after the start is released. If the stop input changes to 0 and the task evaluates the rung, the command becomes 0. Verify output mapping, restart conditions and downstream device response separately. If a contact welds or a conductor shorts to the supply, the bit can remain 1 despite a stop request. Designed emergency stops use safety-rated equipment, appropriate fault detection and validation. Rockwell’s GuardLogix example uses a dual-channel input and monitors the output switching equipment. Ordinary ladder logic does not establish hazardous-energy isolation.

Follow timers, tasks and input timing

For a standard Logix TIMER structure, the preset and accumulated values are in milliseconds. See Rockwell’s TON reference. A TON delays setting its done bit while enabled until the accumulated time reaches the preset. When its rung goes false, it clears the accumulated value and done bit. A TOF sets done while the rung is true and holds done for the preset delay after the rung goes false. An RTO accumulates enabled time across false rungs and an associated reset instruction can clear it. For example, with a 5,000 ms TON preset the done bit is still clear at 3,200 ms of uninterrupted enable. A Logix CTU increments its accumulated count on a false-to-true rung transition. Resolve the actual input transitions and sampling before using the count as evidence of physical events.

A simple controller can be explained as capturing inputs, running logic and updating outputs. In Logix, periodic, event and continuous tasks can execute differently, and I/O updates can arrive independently of ladder execution. The module’s requested packet interval, input filter and the task schedule can all affect whether a short pulse is visible to the logic. Investigate the real path before assuming a faster logic task alone will capture it. See Logix tasks and program guidance.

Worked scaling example

In this example, a MicroLogix application has verified input endpoints of 3,277 and 16,383 to be mapped to 0–100%. At raw value 9,830 the fraction is (9830−3277)/(16383−3277)=0.50(9830-3277)/(16383-3277)=0.50. A legacy MicroLogix SCP instruction scales with user-entered input and output endpoints. Verify the actual module configuration to select the four values. Other controllers offer different scaling methods. MicroLogix instruction set reference.

Compare the HMI display with field and controller data

An HMI reads mapped values and may send authorized operator commands. Displays can present status, alarms, trends and setpoints. A supervisory control and data acquisition (SCADA) system can aggregate information across controllers or sites. PLC application and field testing establish how a command reaches a final element. Reading an HMI indication alone cannot confirm a mechanical result.

Follow a value from the field signal through the input module, scaled PLC tag, communications mapping and display units. For an alarm configured to activate at 200 psi or above and clear at 198 psi or below, the 2 psi deadband prevents small fluctuations within that band from repeatedly setting and clearing the same alarm. At 199 psi, the state depends on the previous threshold crossing. Alarm rationalization establishes purpose, operator action and priority. Shelving can temporarily suppress presentation under a managed procedure. ISA’s 18 series identifies ISA-18.2-2016 and the alarm management lifecycle.

Test Your Knowledge

In the worked motor command, what happens to the rung when StopHealthy changes to 0 and the task evaluates the rung?

A

The hold branch bypasses the stop permissive.

B

Both start and hold branches lose the common permissive and the OTE writes a 0.

C

The input maps directly to an isolation device.

D

The motor command stays latched until an OTU executes.

Test Your Knowledge

The worked Logix TON has a 5,000 ms preset. On execution with a true rung, its accumulated value is 3,200 ms. What is its done bit during ordinary timing?

A

Clear, because accumulated time is below the preset.

B

Set, with accumulated time reset to zero.

C

Set, because the rung is true.

D

Clear until the rung goes false, then set.

Test Your Knowledge

A PLC’s ordinary task intermittently misses a short sensor pulse. What should you investigate?

A

Set the HMI trend scale to a smaller value.

B

Increase the motor output supply voltage.

C

Compare pulse width and input filtering, module data update and task timing.

D

Change the normally open sensor output to an analog value in the HMI.

Sections you finish are checked off in the contents.