How to reset counter using its own output counter complete signal??
11 views (last 30 days)
Show older comments
I have implemented counter logic in simulink with reset & counter complete signal. When I give reset externally logic functions very well. but my requirement is as soon as counter completes target time, it should get reset and starts counting again i.e. cyclic process. without requirement of external reset. So I took counter complete output & feed it back to reset. but it is giving algebric loop error. How to reset counter using its own output counter complete signal??. plz reply its urgent
2 Comments
John BG
on 16 Mar 2017
Hi Pranjali
can you show the Simulink diagram attached to your question?
or a screen shot?
John BG
Answers (1)
Tejas
on 24 Sep 2024
Hello Pranjali,
From the above question, I am assuming that you want to build a counter that automatically resets after reaching its upper limit.
Here are the steps to achieve this:
- Add a Unit Delay block with an initial condition of 0. This block stores the current input at any given time and outputs the previous input. The output of this block will represent the current counter value. For more details on this block, refer to this documentation: https://www.mathworks.com/help/simulink/slref/unitdelay.html .
- Include an Add block that takes inputs from the Unit Delay block and a Constant block with a value of 1.
- Add a Compare To Constant block to receive input from the Add block and check if the count has reached its upper limit.
- Use a Switch block that takes control input from the Compare To Constant block. This block forwards the output of the Add block if the condition is met, otherwise it sends a reset signal.
- Connect the output of the Switch block to the Unit Delay block.
Below is a screenshot of the model:
Here is a screenshot of the expected output:
0 Comments
See Also
Categories
Find more on Measurements and Statistics 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!