R_TRIG Rising edge detector (R_TRIG)
Also called: rising edge trigger, R_TRIG block, one shot, positive edge
Q is 1 for one scan when the rung goes from 0 to 1.
What it does
The R_TRIG block detects the rung's rising edge: its output Q is 1 for exactly one scan, when the rung goes from 0 to 1.
When to use it
To act once per press when the condition is made of several contacts (the P contact watches a single variable).
Operands
| European mnemonic | American mnemonic | Name | Data type | Direction | Required | Access | Meaning |
|---|---|---|---|---|---|---|---|
| Instance | Instance | Instance (the edge’s memory) | R_TRIG | Input | Yes | — | Instance: remembers the value of the previous scan. |
| CLK | CLK | Watched signal | BOOL | Input | Yes | Read (RT1.CLK) | Watched signal: the rung's power flow. |
| Q | Q | Pulse | BOOL | Output | No | Read (RT1.Q) | 1 for a single scan when CLK goes from 0 to 1. |
| Mnemonic | Name | Data type | Direction | Required | Access | Meaning |
|---|---|---|---|---|---|---|
| Instance | Instance (the edge’s memory) | R_TRIG | Input | Yes | — | Instance: remembers the value of the previous scan. |
| CLK | Watched signal | BOOL | Input | Yes | Read (RT1.CLK) | Watched signal: the rung's power flow. |
| Q | Pulse | BOOL | Output | No | Read (RT1.Q) | 1 for a single scan when CLK goes from 0 to 1. |
| Mnemonic | Name | Data type | Direction | Required | Access | Meaning |
|---|---|---|---|---|---|---|
| Instance | Instance (the edge’s memory) | R_TRIG | Input | Yes | — | Instance: remembers the value of the previous scan. |
| CLK | Watched signal | BOOL | Input | Yes | Read (RT1.CLK) | Watched signal: the rung's power flow. |
| Q | Pulse | BOOL | Output | No | Read (RT1.Q) | 1 for a single scan when CLK goes from 0 to 1. |
Readable anywhere in the program, for example RT1.Q. Writable members can be changed by the program (MOVE).
Timing diagram
Timing diagram checked against the simulator (the same engine as the editor).
Example
M1 is 1 for a single scan each time S1 is pressed.
Try it in the simulatorThe example opens in the free simulator; your own program stays as it was.
Behaviour in detail
- Memory starts at 0: if the rung is already 1 on the first scan, Q gives a pulse.
- The edge is detected on the whole rung before it, not on a single variable.
- Each instance has its own memory: do not reuse the same instance in two places.
European (IEC) and American styles
European: R_TRIG block (IEC 61131-3).
American: equivalent to an OSR with its storage bit; here the instance plays the role of that bit.