필터 지우기
필터 지우기

how to implement Simplest down counter

조회 수: 55 (최근 30일)
ANKUR WADHWA
ANKUR WADHWA 2018년 7월 15일
댓글: Nanupatruni Vamsi 2022년 12월 11일
I recently started to try my hands at matlab and simulink , was implementing a counter in simulink , and implemented a simple up counter which counts upto 50
now i want to implement the simplest down counter , but i found my logic for implementing down counter in simulink is quite big , can anyone suggest a simpler logic for down counter with the explanation .
  댓글 수: 5
ANKUR WADHWA
ANKUR WADHWA 2018년 7월 18일
Thanks Jim for the help..
Nanupatruni Vamsi
Nanupatruni Vamsi 2022년 12월 11일
Design Down counter from the value of 50 to 5 after counter have to maintain the value of 5

댓글을 달려면 로그인하십시오.

채택된 답변

Jim Riggs
Jim Riggs 2018년 7월 15일
편집: Jim Riggs 2018년 7월 15일
Your logic seems to suggest that you want something more than just a decrement counter. A simple decrement counter would work exactly the same as an increment counter:
This logic will count down by one. To set a starting value, set the initial condition in the memory block to the desired starting value + 1. So, to start the counter from 20, set the memory initial condition to 21, and the first output from this network is 21-1 = 20.
If you want the counter to stop and hold a value, zero for example, simply add a saturation block:
Set the upper limit in the saturation block to a very large value, and set the lower limit to the desired floor value (0 maybe). This will count down from the initial value in the memory block and hold the lower limit value from the saturation block.
  댓글 수: 3
ANKUR WADHWA
ANKUR WADHWA 2018년 7월 16일
Thanks for the explanation Jim.. i was not aware of the initial conditions in the memory blocks , i was using the delay block to introduce the delay to get rid of Algebraic Loop . Is is possible to add initial condition in the delay block..?? What other elements in Matlab can be used to work as Memory blocks you specified in your example .
Jim Riggs
Jim Riggs 2018년 7월 16일
편집: Jim Riggs 2018년 7월 16일
There are a number of delay function blocks in Simulink, including the one in your sample above. All of these have initial conditions which can be set. Just right-click on the block and select "block parameters".
(also, if you find my answer helpful, please "accept" my answer)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by