新闻中心

EEPW首页>嵌入式系统>设计应用> HOLTEK单片机-数码管显示

HOLTEK单片机-数码管显示

作者: 时间:2012-08-13 来源:网络 收藏

程序:

#include "HT48F50E.H"const unsigned char number[16]={0x81,0xcf,0x92,0x86,0xcc,0xa4,0xa0,0x8f,0x80,0x84,0x88,0xe0,0xb1,0xc2,0xb0,0xb8}; //0-Fvoid delayms(unsigned int dly){unsigned int i;for(i=0;idly;i++){_delay(984);} } //延时函数1MSvoid main(){ unsigned char j;_pac=0x00;_pbc=0x00; //PA,PC输出选择while(1) //大循环{ for(j=0;j50;j++) //循环显示{_pb=0xfe; //选通第一位数码管_pa=number[0]; //显示0delayms(5); //延时5MS(下同)_pb=0xfd;_pa=number[1];delayms(5);_pb=0xfb;_pa=number[2];delayms(5);_pb=0xf7;_ pa=number[3];delayms(5);}for(j=0;j50;j++){_pb=0xfe;_pa=number[4];delayms(5);_pb=0xfd;_pa=number[5];delayms(5);_pb=0xfb;_pa=number[6];delayms(5);_pb=0xf7;_pa=number[7];delayms(5);}for(j=0;j50;j++){_pb=0xfe;_pa=number[8];delayms(5);_pb=0xfd;_pa=number[9];delayms(5);_pb=0xfb;_pa=number[10];delayms(5);_pb=0xf7;_pa=number[11];delayms(5);} for(j=0;j50;j++){_pb=0xfe;_pa=number[12];delayms(5);_pb=0xfd;_pa=number[13];delayms(5);_pb=0xfb;_pa=number[14];delayms(5);_pb=0xf7;_pa=number[15];delayms(5);}}}

上一页 1 2 下一页

关键词:HOLTEK单片机数码管显示

评论


相关推荐

技术专区

关闭