標(biāo)題: 初學(xué)者基于51單片機(jī)數(shù)碼管9到0循環(huán)顯示 [打印本頁]

作者: 33332    時間: 2018-6-30 18:27
標(biāo)題: 初學(xué)者基于51單片機(jī)數(shù)碼管9到0循環(huán)顯示
#include<reg51.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
uchar code DSY_CODE[]={0x90,0x80,0xf8,0x82,0x92,0x99,0xb0,0xa4,0xf9,0xc0,0xFF};

void DelayMS(uint x)
{
uchar t;
while(x--) for(t=0;t<120;t++);
}

void main()
{

uchar i=0;
P2=0x00;
while(1)
{
P2=~DSY_CODE[i];
i=(i+1)%10;
DelayMS(180);
}
}

111111111111.JPG (81.63 KB, 下載次數(shù): 53)

111111111111.JPG





歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1