Search found 7 matches
- Wed Mar 18, 2020 7:23 pm
- Forum: General discussion
- Topic: Blue Pill counting number of pulses using timers
- Replies: 15
- Views: 18929
Re: Blue Pill counting number of pulses using timers
I knew I have posted a similar example already somewhere.
Now i have found it: https://web.archive.org/web/20190316154745/https://www.stm32duino.com/viewtopic.php?f=18&t=3804
Hurray!
It works with no modifications on Blue Pill!
When connected with a 9MHz PWM source it counts 9012 - 9013 pulses ...
- Wed Mar 18, 2020 1:56 pm
- Forum: General discussion
- Topic: Blue Pill counting number of pulses using timers
- Replies: 15
- Views: 18929
Re: Blue Pill counting number of pulses using timers
I new I have posted a similar example already somewhere.
Now i have found it: https://web.archive.org/web/20190316154745/https://www.stm32duino.com/viewtopic.php?f=18&t=3804
Looking at your code with my ignorant eyes I must say that it looks to be the solution to my troubles. I do see
timer ...
- Wed Mar 18, 2020 1:27 pm
- Forum: General discussion
- Topic: Blue Pill counting number of pulses using timers
- Replies: 15
- Views: 18929
Re: Blue Pill counting number of pulses using timers
Hi Kovaxant ,
Can you tell us which core you are using?
Reading your sketch, I think there is a misunderstanding:
In the principle, in Input Capture mode, timer counter is running, and input signal triggers the capture. It means for example that on rising edge the counter value will be stored in ...
- Wed Mar 18, 2020 1:10 pm
- Forum: General discussion
- Topic: Blue Pill counting number of pulses using timers
- Replies: 15
- Views: 18929
Re: Blue Pill counting number of pulses using timers
For 1 sec IRQ you don need any compare channel, just use the update interrupt for that.
I would do it like this:
Timer2.init();
Timer2.pause(); // stop the timer
Timer2.setPeriod(COUNT_RATE);
Timer2.refresh();
Timer2.attachInterrupt(TIMER_UPDATE, count_pulses); // should be done after refresh ...
- Wed Mar 18, 2020 10:25 am
- Forum: General discussion
- Topic: Blue Pill counting number of pulses using timers
- Replies: 15
- Views: 18929
Re: Blue Pill counting number of pulses using timers
I suggest to make a simple sketch for only counting the pulses.
But first you should describe the logic how do you want to achieve the counting with those timers.
How exact should be the 5 ms measuring period?
You could use the slave gated mode to achieve your goal, see RM0008 15.3.14.
I have ...
- Wed Mar 18, 2020 9:16 am
- Forum: General discussion
- Topic: Blue Pill counting number of pulses using timers
- Replies: 15
- Views: 18929
Re: Blue Pill counting number of pulses using timers
I don't understand why do you need 3 timers to count some pulses...
Can you describe your logic?
Hi,
This code is just a part of the project of controlling the functions of a hifi DAC. Intention is to have it count "in the background". As I understand that is accomplished using hardware timers ...
- Wed Mar 18, 2020 7:59 am
- Forum: General discussion
- Topic: Blue Pill counting number of pulses using timers
- Replies: 15
- Views: 18929
Blue Pill counting number of pulses using timers
Hello everyone!
My first post and asking for help already. I'm new to all this arduino and Blue Pill stuff. Had to learn a lot to solve a problem.
What I'm trying to do is count the number of pulses every second for 5ms. I'm using counters for time interrupts and for counting the number of pulses ...
My first post and asking for help already. I'm new to all this arduino and Blue Pill stuff. Had to learn a lot to solve a problem.
What I'm trying to do is count the number of pulses every second for 5ms. I'm using counters for time interrupts and for counting the number of pulses ...