PWM breathing lamp based on stm32

Source: Internet
Author: User

The program involved in this section of the hardware is relatively simple, mainly to investigate the application of the Stm32 clock

The principle of nature of things I would not say more, bibliography for:
"STM32 Library Development Practical Guide" Liu, Dr Yeung Sum
"STM32 Development Guide (library function Version)" On the punctual atom

A timer is used to control the I/O port output PWM waveform, which drives the LED light to appear similar to the normal breathing frequency of the light off.

Hardware circuit diagram:

What I have learned:
1
This is the STM32 data sheet on the TIM3 Universal Timer multiplexing function re-image description, assuming that the PA6 as a PWM output, you can see PA6 corresponding to TIM3 Channel 1,
Enable the function of TIM3 Channel 1 to be

TIM_OC1Init();

Similarly, if you want to enable PA7, which corresponds to the TIM3 Channel 2, then the function of Enable Channel 2 is:

TIM_OC2Init()

And so on, it should be noted that the function that enables different channels of the same timer is a small difference, preventing the Tim_oc1init () function from being called in the program to enable TIM3 Channel 2 to occur.

2
Look here, assuming that the TIM3 Channel 1 is used, then this is going to be written

TIM3->CCR1

Similarly, if you use the TIM3 Timer Channel 2, it is necessary to change the corresponding

TIM3->CCR2

This is also to prevent the original plan to use the TIM3 Channel 1, but here self-pendulum to write in order to TIM->CCR2 situation, such errors are generally very hidden, not easy to find.

The corresponding program has been uploaded, but do not know why the program can not be displayed here, need to download the resources to go to my download.

The project document is
PROGECT–>RVMDK (UV4) –>iso_stm32

PWM breathing lamp based on stm32

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.