Implementing a customised counter in SIMULINK using basic blocksets

조회 수: 1 (최근 30일)
Mohammed Manna
Mohammed Manna 2013년 7월 26일
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
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
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.

카테고리

Help CenterFile Exchange에서 Event Functions에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by