赞
踩
#include<iom16v.h>
#include<macros.h>
#define uchar unsigned char
#define uint unsigned int
/******************************
共阴数码管码表:0~f
/******************************/
uchar table[]={
0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,
0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x00};
uchar table1[]={0x01,0x02,0x04,0x08,0x00};
/******************************/
void delay (uint z)
{
uint x,y;
for(x=0;x<z;x++)
for(y=0;y<1000;y++);
}
/******************************/
//主函数显示0123
/******************************/
void main()
{
uchar i;
DDRD=0XFF;
DDRC=0XFF;
while(1)
{
for(i=0;i<4;i++)
{
PORTD=table1[4];
//DDRD=0XFF;
//DDRC=0Xff;
PORTC=~table[i];
PORTD=table1[i];
delay(1);
}
}
}
完整资料打包(含仿真):
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。