Is there any Stateflow examples to detect the rising and falling edge of the input clock pulse ?

18 views (last 30 days)
Example: State flow logic should increment the output only during rising edge of input clock pulse, and should decrement the output during falling edge of input clock. Also logic should supports for code generation.
This can be done using two State flow, but is there any ways to do this using only one State flow?

Answers (1)

Chetna Jain
Chetna Jain on 11 Jun 2018
Hi Parashara,
There is no direct solution to detect rising/falling edge of an input in Stateflow,one needs to Implement the edge detection inside the Stateflow chart with local variables.
However, you can activate a Stateflow chart via a change in control signal (an edge-triggered input event) or a function call from a Simulink block (a function-call input event). you can find the details in below-mentioned link:
In Simulink it can be done easily using “Detect Increase” & “Detect Decrease” blocks !!

Categories

Find more on Complex Logic in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!