cancel
Showing results for 
Search instead for 
Did you mean: 

HELP with PWM measurement

MoHos98
Associate II

Hello everyone

I am to use the Timer3 of STM8s105C6T in order to measure the duty cycle of a specific signal.

But I also want the MCU to reset if this signal is disconnected.

I am using PWMI feature of this timer meaning that rising edge and falling edge are detected respectively

Is there any way to find out that this signal is disconnected? How?

Thanks!

2 REPLIES 2
MasterT
Lead

Usually, to define if something connected / not con-ed you should apply a small current and test input level. Easiest way is to activate internal pull-up or pull-down resistors, consequently reading "high" or "low" for specific period of time would indicate disconnection event.

There is also an option to link another low freq. PWM via external (~a few kOHm) resistor for the same purpose

Thanks for your help.

under normal condition, this pin is connected to the PWM signal. I just wanted to know the moment that this signal disconnects by accident by the software.

taking your advice, I also connected this signal to another pin and used ADC and read the level of it. It perfectly worked.