Cheug's Blog

当前位置:网站首页 / 电子技术 / 正文

集成式数码管动态扫描显示

2016-12-14 / 电子技术 / 1836 次围观 / 0 次吐槽 /
#include<reg52.h>
#define INT8U unsigned char
#define INT16U unsigned int

code INT8U SEG_CODE[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};

code INT8U array[]={2,0,1,5,1,2,1,4};

void delay_ms(INT16U x){
 INT8U t; while(x--) for(t=0;t<120;t++);
}

void main(){
 INT8U i;
 while(1){
   for(i=0;i<8;i++){
	P0=0xff;
	P2=1<<i;
	P0=SEG_CODE[array[i]];
	delay_ms(4);
   }
 }
}


额 本文暂时没人评论 来添加一个吧

发表评论

必填

选填

选填

必填

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Powered By Cheug's Blog

Copyright Cheug Rights Reserved.