#include
#define DataPort P0 //界说数据端口 程序中遇到DataPort 则用P0 替换
#define CtrlPort P1 //界说操控端口
#define uint unsigned int
unsigned char code DuanMa[10]={0xc0,0xf9,0xa4,0xb0, 0x99,0x92,0x82,0xf8,0x80,0x90};// 显现段码值0~9
unsigned char code WeiMa[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};//别离对应相应的数码管点亮,即位码
unsigned char TempData[8]; //存储显现值的全局变量
sbit key=P3^1; //对应于s18按键
void Delay(unsigned int t); //函数声明
void Display(unsigned char FirstBit,unsigned char Num);
void delay1(uint z)
{
uint x,y;
for(x=z;x>0;x–)
for(y=110;y>0;y–);
}
void main (void)
{
// DuanMa=0xff;
while(1)
{
if(key==0)
{
delay1(5);
if(key==0)
{
a++;
while(!key);
}
}
TempData[0]=DuanMa[a]; //分化显现信息,
Display(0,3);
}
void Delay(unsigned int t)
{
}
void Display(unsigned char FirstBit,unsigned char Num)
{
}
声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/news/dongtai/260880.html