标题: 数码管动态显示 [打印本页]

作者: 飞宇轩    时间: 2018-6-1 13:15
标题: 数码管动态显示
#include<reg52.h>
#define uchar unsigned char
#define uint  unsigned int
uchar code table[10] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
uchar code LED_W[8] = {0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
void Delay(uint i)
{
uchar x,j;
for(j=0;j<i;j++)
for(x=0;x<=148;x++);
}

void Main(void)
{
while(1)
{
  P0 = 0;      
  P2 = LED_W[1];   
  P0 = table[1];   
  Delay(100);   
  P0 = 0;      
  P2 = LED_W[0];   
  P0 = table[2];  
  Delay(100);      
}
}





欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1