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

專注電子技術(shù)學習與研究
當前位置:單片機教程網(wǎng) >> MCU設(shè)計實例 >> 瀏覽文章

單片機led動態(tài)顯示程序

作者:佚名   來源:本站原創(chuàng)   點擊數(shù):  更新時間:2008年08月25日   【字體:

;*****************************************************************************
;: 描述:此51單片機led動態(tài)顯示程序的電路很簡單這里我就不畫出來,就是p2口,通過470歐姆的電阻接led燈然后連到正5v電源。請http://www.raoushi.com 的讀者自行裝配好電路,加電阻的目的是限流保持單片機正常運行
;******************************************************************************
include <reg52.h>
#include <intrins.h>

#define D_P0 P0 //端口定義
#define D_P1 P1 //
#define D_P2 P2 //
#define D_P3 P3 //

#define uchar unsigned char
#define uint unsigned int
uint h;

uchar code table[16]={0x0fe,0xfd,0xf7,0xef,0xdf,0xbf,0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe,0xff};//

//11us延時函數(shù)
void delay(uint t)
{
for(;t>0;t--);
}

//單片機led動態(tài)顯示函數(shù)
scan()
{
uint k;
for(k=0;k<16;k++) //
{
D_P2 = table[k];
delay(5000);
delay(5000);
}
}

//程序的主函數(shù)
main()
{
D_P0 = 0xff; //初始端口
D_P1 = 0xff; //
D_P3 = 0xff; //
while(1)
{
for(h=0;h<500;h++)
{
scan();
}
}
}

這樣就能使的led出現(xiàn)連續(xù)閃動顯示的動態(tài)效果。希望廣大學友試驗成功。

關(guān)閉窗口