Showing results for 
Search instead for 
Did you mean: 

Pulse width Measurement


Hey there,


I'm a first-time user of the STM32 and I'm using the STM32F103C8T6 (Bluepill Board). I'm trying to measure the pulse width of two signals at the same time. I'm using two timers with input capture mode for this, but it's not working properly. I don't understand what the problem is. When I connect one signal at a time, it measures properly, but it starts fluctuating when I connect both signals. One of my signals is in microseconds (approximately 200us) and the other is in milliseconds (approximately 1.8ms). Please take a look at my code and help me out. I've set the controller at maximum speed, i.e. 72MHz. The starting time of both signals is not fixed it can start at any time.

The project File is Attached.



It Shows this Output when I connect both signals. in this, I connected a 200us pulse to width 1 and a 1.8 ms pulse to width 2. 


this is the output when I connect a single signal at a time.

plz, help me with how I can measure both pulses accurately. if any one has a sample code please give it.