




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、電路圖電路功能:1. 實(shí)現(xiàn)三個(gè)LED燈的十個(gè)不同亮度等級(jí)的調(diào)光,光強(qiáng)等級(jí)在數(shù)碼管上顯示出來;2. 三個(gè)LED燈的調(diào)光方式可以有自動(dòng)調(diào)光、手動(dòng)調(diào)光和根據(jù)外部光強(qiáng)自動(dòng)調(diào)光;3. 本電路還可以進(jìn)一步成為開發(fā)LED燈的更多功能的實(shí)驗(yàn)電路。 驅(qū)動(dòng)程序:#include <at89x51.h>#define uchar unsigned char#define uint unsigned int#include<intrins.h>
2、;sbit st=P30;sbit oe=P35;sbit eoc=P31;sbit up=P32;sbit down=P33;sbit clk=P34;sbit zd=P17;sbit sd=P15;sbit wd=P16;sbit red=P10;sbit green=P11;sbit blue=P12;uchar codetab=0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x80,0x39,0x5e,0x79,0x71,0x00,0xf3,0x76,0x80,0x40;/數(shù)碼管顯示段碼uchar m,k,l;int a=
3、5,b;void maichong();void delaynms(uint x);/nms延時(shí)程序void ad0809();/芯片啟動(dòng)程序main()/*自動(dòng)調(diào)光程序*/ while(!zd) uint a,b; uchar c,d; for(a=0;a<10;a+) if(!zd)
4、; for(c=20000;c>0;c-) for(d=10;d>0;d-) red=1; green=1;&
5、#160; blue=1; P0=codetaba; delaynms(a); b=10-a;
6、 red=0; green=0; blue=0; delaynms(b);
7、0; for(a=9;a>0;a-) if(!zd) &
8、#160; for(c=20000;c>0;c-) for(d=10;d>0;d-) red=1;
9、 green=1; blue=1; &
10、#160; P0=codetaba; delaynms(a); b=10-a;
11、 red=0; green=0; blue=0; delaynms(b);&
12、#160;
13、; /*手動(dòng)調(diào)光程序*/ while(!sd) EA=1; EX0=1; EX1=1; IT0=0; IT1=0; a=5; while(!sd)
14、 P0=codetaba; red=1; green=1; blue=1; delaynms(a); red=0; green=0; blue=
15、0; delaynms(10-a); /*外動(dòng)調(diào)光程序&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
16、;&&&&&&&&&&&&&&&&&&&&&&&&&&&&/ while(!wd) int m,i,shu,x; while(!wd) c
17、lk=0; st=0; oe=0; eoc=1; _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); clk=1;
18、60; _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); clk=0; st=1;
19、0;_nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); clk=1; _nop_(); _nop
20、_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); clk=0; st=0; _nop_();
21、; _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); clk=1; _nop_(); _nop_(); _nop_();
22、60; _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); for(i=8;i-;i>0) /08個(gè)時(shí)鐘周期 clk=0;
23、0;_nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_();
24、0; clk=1; _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_();
25、_nop_(); clk=0; _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_();
26、60; _nop_(); clk=1; _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_();
27、160; while(!eoc) clk=0; _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_();
28、;_nop_(); _nop_(); clk=1; _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); &
29、#160; _nop_(); _nop_(); _nop_(); /等待轉(zhuǎn)換結(jié)束此時(shí)繼續(xù)給脈沖 clk=0; _nop_(); _nop_(); _nop_();
30、 _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); clk=1; _nop_(); _nop
31、_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); clk=0; oe=1; _nop_(); _nop_(); &
32、#160; _nop_(); _nop_(); _nop_(); _nop_(); m=P2;/數(shù)據(jù)有效 _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_();
33、160; clk=1; _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_();
34、0; clk=0; _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); clk=1;
35、160; oe=0; _nop_(); _nop_(); _nop_(); clk=0; _nop_(); _nop_(); _nop_(); _nop_();
36、60; shu=(m*2)/51; for(x=5000;x-;x>0) P0=codetabshu; red=1; green=1; blue=1; for(i=shu;i-;i>0) clk=0; _nop_(); _nop_(); _nop_();
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 動(dòng)脈瘤術(shù)后的護(hù)理
- 公交員工教育培訓(xùn)
- 中學(xué)音樂教育體系構(gòu)建與實(shí)踐路徑
- 裝修電銷話術(shù)培訓(xùn)
- 中職教育發(fā)展探索與實(shí)踐
- 特殊口腔護(hù)理
- 2025年海洋生態(tài)保護(hù)與修復(fù)政策對(duì)海洋生態(tài)系統(tǒng)服務(wù)功能可持續(xù)性提升策略報(bào)告
- 休閑農(nóng)業(yè)與鄉(xiāng)村旅游融合發(fā)展規(guī)劃報(bào)告:鄉(xiāng)村旅游與旅游產(chǎn)業(yè)融合的商業(yè)模式創(chuàng)新001
- 繪畫火龍果課件
- 小學(xué)數(shù)學(xué)教師入職面試培訓(xùn)
- 車輛進(jìn)廠出廠管理制度
- 安全生產(chǎn)月題庫-2025年安全生產(chǎn)月安全知識(shí)競(jìng)賽題庫(附題目答案)
- 2025-2030年古建筑行業(yè)市場(chǎng)深度調(diào)研及前景趨勢(shì)與投資研究報(bào)告
- 2024年貴州省黔西縣教育局公開招聘試題含答案分析
- 集裝箱投資項(xiàng)目可行性研究報(bào)告
- 拆分合同:合伙企業(yè)解散及債務(wù)分擔(dān)協(xié)議
- 2025河北邯鄲市肥鄉(xiāng)區(qū)選聘農(nóng)村黨務(wù)(村務(wù))工作者100人筆試參考題庫完整參考答案詳解
- 2025年中小學(xué)美術(shù)教師招聘考試美術(shù)專業(yè)知識(shí)必考題庫及答案(共170題)
- 2025年05月四川阿壩州級(jí)事業(yè)單位公開選調(diào)工作人員78人筆試歷年典型考題(歷年真題考點(diǎn))解題思路附帶答案詳解
- 2025-2030中國硫酸鈣晶須行業(yè)市場(chǎng)發(fā)展現(xiàn)狀及競(jìng)爭(zhēng)格局與投資發(fā)展研究報(bào)告
- DB31/T 1035-2017綠化有機(jī)覆蓋物應(yīng)用技術(shù)規(guī)范
評(píng)論
0/150
提交評(píng)論