cancel
Showing results for 
Search instead for 
Did you mean: 

Pulse width Measurement

Atul_Dighe
Associate

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.

 

Atul_Dighe_0-1717408343733.png

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. 

Atul_Dighe_1-1717408394287.pngAtul_Dighe_2-1717408427121.png

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.

 

 

 

0 REPLIES 0