2020-11-12 10:21 AM
Hello, currently I'm working on a PWM signal generation project. I can generate PWM for certain values. But I need to change them during experiment.
For example, at start PWM going to work on 1KHz freq. and 10ns pulse witdh. Then I'll change them with buttons, first button will add 100Hz and it will be 1100Hz, second button will make it 900Hz and other two buttons will do the same for pulse witdh.
What should I use for that? An example code woulde be great. But I need any ideas, I'm desperate right know.
2020-11-12 10:26 AM
Once it's started, you can change duty cycle and period by changing the timer's ARR and CCRx registers.
Period is (timer clock) / (PSC + 1) / (ARR + 1).
Duty cycle is CCRx / (ARR + 1).
STM32F isn't a chip, try to be more specific.
2020-11-12 10:28 AM
How can I adapt buttons for this? With ADC?
2020-11-12 11:11 AM
Btw I'm using STM32F407VG for this project.