定時器控制LED Experiment 1 Timer control LED
1.1 實驗要求 Experimental requirement利用51單片機產生占空比可變的PMW波,當產生該波形的I/O口通過濾波電路與LED燈相接后,由于輸出PMW波占空比不斷變化,使得一個周期內有一部分時間LED導通,一部分時間截止,從整體來看有一個變化的平均電壓加在LED燈上,從而達到動態調節LED燈亮度的目的。
Student use C51 to produce a variable PMW wave. The I/O ports generate the wave through the filter circuit and connect with LED lights. As the output PWM wave duty cycle is constantly changing, a part of the time period LED turns on, part of the time cut off. From the overall point of view there is a change in the average voltage added to the LED lights, so as to achieve the purpose of dynamically adjust the brightness of LED lights
1.2 實驗任務 Tasks利用51單片機設計一個呼吸燈。所謂呼吸燈是指LED燈光在單片機的控制之下完成由亮到暗,再從暗到亮的逐漸變化,感覺好像是人在呼吸。
要求在P1.0口輸出占空比變化的PMW波,通過LC低通濾波電路接到LED燈,控制LED燈的亮度變化。這里濾波電路的作用是防止LED燈閃爍太快導致人眼感覺不到亮度的變化。
Design a breathing light with C51 MCU. The so-called breathing light is the LED lights in the MCU control, and the light from the br ight to the dark, and then from dark to bright gradually change, feeling like people are breathing.
1、實驗源程序(整理經過運行證明是正確的源程序,并加上分析注釋)
2、思考題回答(首先將問題翻譯成英文,然后用英文回答)
1、定時器和計數器的區別是什么?
2、單片機定時器/計數器T1、T0的工作方式2有什么特點?適用于哪些應用場合?
(1)What is the difference between a timer and a counter?
A counter is the one that keeps counting when you start counting from zero! Unless you stop him, he won't keep remembering! The timer is different! You need to set a time for yourself before you start counting! When your time has been counted down, it stops automatically
Mode 2 is an 8-bit timer / counter automatically loaded with initial value, which overcomes the problem of cycle timing or cycle counting application There is a problem that the counting initial value is loaded repeatedly with the instruction, which affects the timing accuracy.
In this experiment, we need to select the appropriate crystal frequency and use LC low-pass filter circuit to prevent the LED from changing too fast to feel the change of brightness.Through this experiment, I have a better understanding of the combination circuit and programming of single-chip computer.The experiment is time-consuming and uncomplicated, and can be completed quickly with the help of the teachers and classmates.Finally, thank you for your teacher's instruction and your classmates'warm help.
完整的Word格式文檔51黑下載地址:歡迎光臨 (http://www.zg4o1577.cn/bbs/) | Powered by Discuz! X3.1 |