# Pulse gate
Conditionally passes or blocks a pulse signal based on the state of an enable input. When a rising edge arrives on the input and enable is true, the pulse is forwarded to the output. When enable is false, the pulse is suppressed.
Pulse gate
I
E
O
# Inputs
| ID | Abbrev | Name | Type | Default | Description |
|---|---|---|---|---|---|
input | I | Input | BOOLEAN | false | Pulse signal. A rising edge triggers evaluation of the enable state to decide whether to forward the pulse. |
enable | E | Enable | BOOLEAN | true | Level input checked at the moment a pulse arrives. When true, pulses pass through. When false, pulses are blocked. Changing this input does not trigger output on its own. |
# Outputs
| ID | Abbrev | Name | Type | Default | Description |
|---|---|---|---|---|---|
output | O | Output | BOOLEAN | false | Forwarded pulse. Mirrors the input pulse when the gate is enabled. |
# State
| ID | Name | Type | Default | Unit | Description |
|---|---|---|---|---|---|
prev_input | Previous input state | BOOLEAN | false | Stores the previous state of the input to detect rising and falling edges. |
# Source Code
View Volang source
channel = input::channel()
value = input::value()
if (channel == "input") {
prev_input = state::get("prev_input")
if (value and !prev_input) {
if (input::get("enable")) {
output::set("output", true)
}
}
if (!value and prev_input) {
output::set("output", false)
}
state::set("prev_input", value)
}
