define a counter which will starts counting from zero automatically when the count reaches to 10

14 vues (au cours des 30 derniers jours)
Hello all , can you please explain how to model a simple counter which will continue to count from the start when it reaches its max value to 10.

Réponses (2)

Chunru
Chunru le 16 Nov 2022
c = 0; % initialization
while true
c = mod( c + 1, 10); % count from 0 to 9 then re-start
end

Andy Bartlett
Andy Bartlett le 16 Nov 2022
In a Simulink model, click on the canvas and type "counter"
you'll see a list of blocks
one of these is called Counter Limited
it does exactly what you are asking for.
  1 commentaire
Rakesh Singare
Rakesh Singare le 17 Nov 2022
instead here, i have used delay block.it will take feedback from output and gets added in the input again for increamenting its value by +1 again and again until it reaches to value 10. i have used switch block providing condition that if input > 10 , then output =0.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Schedule Model Components dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by