Pro
10 min

Lesson 7 — Edge Trigger (R_TRIG)

curriculumlessonedgeone-shot

Ready to build this?

Sign up free — no credit card required. This scenario requires the Pro plan.

Sign up to play this scenario →

Already have an account? Log in

Lesson 7 — Edge Trigger (R_TRIG) scenario preview

Briefing

R_TRIG fires COUNT_PULSE for exactly one scan when BUTTON transitions from false→true. No matter how long you hold BUTTON, COUNT_PULSE is only true for a single scan. This one-shot behaviour is essential for counting, incrementing, and event detection.

Objectives

  • COUNT_PULSE goes true for one scan on each rising edge of BUTTON
  • Holding BUTTON does not keep COUNT_PULSE true

Hints

  • Declare an R_TRIG instance: EDGE_DET : R_TRIG;
  • Call it: EDGE_DET(CLK := BUTTON); then use EDGE_DET.Q as your one-shot.

I/O Table

Inputs

BUTTON

Push-button input

BOOL · %I0.0

Outputs

COUNT_PULSE

One-shot pulse output

BOOL · %Q0.0

Your program will be tested against:

All test cases run automatically when you submit. Assertions are hidden until you pass.

  1. #1Rising edge generates one COUNT_PULSE

    BUTTON false→true → COUNT_PULSE briefly true then false

Ready to build this?

Sign up free — no credit card required. This scenario requires the Pro plan.

Sign up to play this scenario →

Already have an account? Log in

Competency and practice field guide

PLC edge-detection curriculum scenario: practice plan

Direct answer

The learner can generate exactly one event for a declared transition, explain the memory bit and prove behavior across startup, bounce and rapid changes.

Written for pLC beginners learning why a maintained Boolean condition differs from a one-scan event.

a PLC logic and scan-cycle training station with observable inputs, outputs, timing traces and program state used to prove execution behavior while studying rising-edge and falling-edge detection across repeated PLC scans
System map / 02

NODE 01observable

Scope

Current sample, previous sample, rising or falling transition, one-scan pulse, memory initialization, task period, input filter and consumer ownership.

NODE 02observable

Signal path

Field or simulated Boolean through input sampling, previous-state comparison, pulse tag, consuming instruction and resulting count or transition.

NODE 03observable

Baseline practice

One clean off-to-on change produces one rising event and a maintained on state produces no additional events.

NODE 04observable

Edge cases

Input already on at startup, contact bounce, two changes within a scan, task restart, retentive memory, multiple consumers and falling transition.

NODE 05observable

Fault practice

An input-sampling, previous-state, initialization, scan-timing, pulse-ownership or consumer mismatch.

NODE 06observable

Transfer to the job

The pattern recreated in official software and tested against the intended task and controller startup behavior.

Answer surface / 07

What is edge detection in a PLC?

It compares the current Boolean sample with a remembered previous sample to produce a pulse only when the selected transition occurs.

Why does a PLC one-shot sometimes fire at startup?

Initialization or prescan behavior can make the first sampled state appear to be a transition; define startup state and verify the exact platform semantics.