欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3112|回復: 0
打印 上一主題 下一主題
收起左側

基于c51單片機的呼吸燈實驗中英文技術文檔

[復制鏈接]
跳轉到指定樓層
樓主
ID:861693 發表于 2020-12-17 20:57 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式

定時器控制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

  • What are the characteristics of working mode 2 of timer / counter T1 and t0? For which applications?

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)

評分

參與人數 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵!

查看全部評分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏1 分享淘帖 頂 踩
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表