Subroutine: How to manage Rising Edge and Falling Edge in Flow Chart


The easiest way to handle the rising and falling edge in a flowchart is to use a subroutine

For rising edge (rising front), add a subroutine named as example RisingEdge, with 2 tags, input and output Bits

  • In (Bit) with one way “ > „
  • Out (Bit) with 2 ways “ <> „

In you main program, call the subroutine with your input in the „In“ tag, and the Rissing Edge tag in the „Out“ tag

In this example, „OutBitD1“ will be set to 1 only once during the PLC cycle, as soon as InBitC1 changes from 0 to 1

Do the same for the falling edge (falling front)

For your input, if you are using a dry contact from a switch or relay, it may be useful to add a bounce filter (Debounce in ms)