How to reset counter using its own output counter complete signal??
11 次查看(过去 30 天)
显示 更早的评论
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 个评论
John BG
2017-3-16
Hi Pranjali
can you show the Simulink diagram attached to your question?
or a screen shot?
John BG
回答(1 个)
Tejas
2024-9-24
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Measurements and Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!