2017-09-08 05:19 AM
Hello all,
My question is how to read ADC value ( AC and DC (voltage and current ) ) If I want to generate 20khz signal and vary duty cycle (0-100%) of PWM according to ADC value how it can do and how to reload any value of PWM (at instant of time) Please guide me with an example
2017-09-08 05:29 AM
>>Please guide me with an example
And you're using what part, with what TIM, and pins for input vs output?
Take the ADC sample, 0..4095, scale it so fits within the period of the TIM, and write that value into TIMx->CCRx, secondary school level math.
Where Period = N-1, 0% = 0, 50% = N/2, 75% = 3N/4, 100% = N