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 mnemonicAmerican mnemonicNameData typeDirectionRequiredAccessMeaning
InstanceInstanceInstance (the edge’s memory)R_TRIGInputYes—Instance: remembers the value of the previous scan.
CLKCLKWatched signalBOOLInputYesRead (RT1.CLK)Watched signal: the rung's power flow.
QQPulseBOOLOutputNoRead (RT1.Q)1 for a single scan when CLK goes from 0 to 1.
MnemonicNameData typeDirectionRequiredAccessMeaning
InstanceInstance (the edge’s memory)R_TRIGInputYes—Instance: remembers the value of the previous scan.
CLKWatched signalBOOLInputYesRead (RT1.CLK)Watched signal: the rung's power flow.
QPulseBOOLOutputNoRead (RT1.Q)1 for a single scan when CLK goes from 0 to 1.
MnemonicNameData typeDirectionRequiredAccessMeaning
InstanceInstance (the edge’s memory)R_TRIGInputYes—Instance: remembers the value of the previous scan.
CLKWatched signalBOOLInputYesRead (RT1.CLK)Watched signal: the rung's power flow.
QPulseBOOLOutputNoRead (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

CLKQ0123456789101112scans

Timing diagram checked against the simulator (the same engine as the editor).

Example

European style
American style

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

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.

See also