Pro
10 min

Lesson 7 — Edge Trigger (R_TRIG)

curriculumlessonedgeone-shot
Lesson 7 — Edge Trigger (R_TRIG) scenario preview

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

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