Implementing a customised counter in SIMULINK using basic blocksets
1 view (last 30 days)
Show older comments
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 Comment
Ryan G
on 26 Jul 2013
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.
Answers (1)
Guy Rouleau
on 26 Jul 2013
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 Comments
See Also
Categories
Find more on General Applications in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!