Implementing a customised counter in SIMULINK using basic blocksets
1 次查看(过去 30 天)
显示 更早的评论
I am trying to implement a counter logic in SIMULINK where
in1, in2 are inputs
out1 is the output
if in2 = 0, out1 = 0;
if in2 = 1, out1 = 1 after x high edges of in1
I have tried using "Detect Rise Positive" block but failed miserably because I don't have sufficient experience of implementing a timing diagram correctly in SIMULINK. Could anyone kindly point me to the right direction?
*Update*
An approach I have taken since I posted this question is the "Triggered and enabled subsystem". I am trying to set it up so that:
in2 becomes the enable signal
in1 becomes the trigger
in2 becomes the intput to the subsystem
Out1 becomes the output of the subsystem
But I think that the above was rubbish. Unfortunately it is not VHDL where I could have implemented it using 4-5 lines of description of the hardware logic. :(
Ta
1 个评论
Ryan G
2013-7-26
Why do you have the requirement to use basic blocks? I think this would be easy to do in Stateflow.
In Simulink, I think this should be simple enough to do with a switch and unit delay along with some crafty modeling.
回答(1 个)
Guy Rouleau
2013-7-26
I would use the discrete time integrator (or the equivalent using Sum and Unit Delay). If the input is zero, it will stay at zero. If the input is one, the output will start increasing. Use a Relational Operator to detect the numbe X of iteration. If you need some come complex resetting scheme, a few Switch and reset port and saturation of the integrator should help.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Event Functions 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!