1 (edited by nicolas0481 04-02-2022 17:20:31)

Topic: Counter/switch

Hello,

I'm trying to use a counter to switch between different values of a switch block (see attachment). I use kind of feedback to reset the counter as soon he reaches specific value. But it doesn't seem to work. I would like to adjust constant value '2' in the examples to walk trough index 0 and 1 of the switch, or to adjust to 5 to walk trough value 0,1,2,3,4. value from index '0' never come to output.
Is it a problem of synchronisation, or problems regarding rising/falling edges of the 'clock'?

Thanks

Nico

Post's attachments

Attachment icon counter.cfd 2.32 kb, 186 downloads since 2022-02-04 

2

Re: Counter/switch

There is no attachment in your post. Please add.
Also, you can run your diagram in CannyLab Simulator, add some breakpoints and run or step it to see what exactly going on:
https://cannylogic.com/docs/cannylab/simulator/

3

Re: Counter/switch

sorry forget to click 'add'

4

Re: Counter/switch

Is it a problem of synchronisation, or problems regarding rising/falling edges of the 'clock'?

Perhaps both.

Please try the attached diagram.
The PWM timings are increased for better visualization in Simulator.
All edited parts are marked.

Post's attachments

Attachment icon counter-1_1.cfd 2.57 kb, 174 downloads since 2022-02-05