久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

標題: 基于c51單片機的呼吸燈實驗中英文技術文檔 [打印本頁]

作者: zqiiii    時間: 2020-12-17 20:57
標題: 基于c51單片機的呼吸燈實驗中英文技術文檔

定時器控制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.3 硬件電路 hardware circuit
1.4 實驗文檔 Report

1、實驗源程序(整理經過運行證明是正確的源程序,并加上分析注釋)

  1. #include <reg52.h>//包含 寄存器的頭文件
  2. typedef unsigned char u8;//定義無符號數
  3. u8 Tcount,dutyfactor,direct;
  4. sbit LED=P1^0;//是將發光二極管 led1 接 P1口 0 位端
  5. void InterruptInit();//
  6. void Time0();//
  7. void breatheLED();//定義函數
  8. void main()
  9. {
  10. InterruptInit();
  11. while(1)//無限循環
  12.               {
  13.                             breatheLED();
  14.               }
  15. }
  16. void InterruptInit()
  17. {
  18.               TMOD &= 0xf0;//TMOD高四位清零,并保存低四位不變化
  19.               TMOD |= 0x02;//設定T0的工作模式為工作方式2
  20.               TH0 = 0x48;
  21.               TL0 = 0x48;//設置定時器
  22.               ET0 = 1;
  23.               EA  = 1;
  24.               TR0 = 1;//設置電頻
  25. }
  26. void Time0() interrupt 1
  27. {
  28.               TH0 = 0x48;
  29.               TL0 = 0x48;
  30.               Tcount++;
  31. }
  32. void breatheLED()
  33. {
  34.               if(Tcount >= 60)//條件判斷
  35.               {
  36.                             Tcount = 0;
  37.                             if(direct == 0)
  38.                             {
  39.                                           dutyfactor++;
  40.                             }
  41.                             else if(direct == 1)
  42.                             {
  43.                                           dutyfactor--;
  44.                             }
  45.               }
  46.               if(dutyfactor <= 0)
  47.               {
  48.                             direct=0;
  49.               }
  50.               else if(dutyfactor >= 60)
  51.               {
  52.                             direct=1;
  53.               }
  54.               if(Tcount < dutyfactor)
  55.               {
  56.                             LED=0;//燈亮
  57.               }
  58.               else
  59.               {
  60.                             LED=1;//燈滅
  61.               }
  62. }
復制代碼



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黑下載地址:
c51呼吸燈.docx (508.93 KB, 下載次數: 10)






歡迎光臨 (http://www.zg4o1577.cn/bbs/) Powered by Discuz! X3.1
主站蜘蛛池模板: 狠狠色狠狠色综合系列 | 一区二区三区四区免费观看 | 欧美h版| 国产精品av久久久久久毛片 | 日韩福利在线观看 | 日本免费一区二区三区视频 | 国产成人精品一区二 | 一级片网址 | 国产日韩欧美在线 | 91精品一区| 久久99精品国产 | 国产美女久久久 | 成人夜晚看av | 国产精品99视频 | 久久在线视频 | 国产精品一区二区免费 | h片在线免费看 | 亚洲国产精品99久久久久久久久 | 天天激情综合 | 日韩三级电影在线看 | 综合色久 | 精品国产一区二区国模嫣然 | 日韩视频免费 | 日韩视频一区二区 | 久久精品国产99国产精品 | 精品久久网 | 热久久性 | 欧美一区二区三 | 成人福利网站 | 性福视频在线观看 | 黄片毛片免费看 | 天天爽夜夜爽精品视频婷婷 | 欧美伊人久久久久久久久影院 | 日韩免费高清视频 | 国产精品一区二区av | 精精国产xxxx视频在线播放 | 成人免费在线播放 | 99这里只有精品视频 | 日韩精品一区二区三区在线播放 | 国产成人av一区二区三区 | 国产伦一区二区三区视频 |