To vary duty cycle of pwm according to adc value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2017-09-08 5: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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2017-09-08 5: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
Up vote any posts that you find helpful, it shows what's working..
