Chinaunix首页 | 论坛 | 博客
  • 博客访问: 182743
  • 博文数量: 54
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 2018
  • 用 户 组: 普通用户
  • 注册时间: 2013-03-31 23:14
文章存档

2014年(2)

2013年(52)

分类: 嵌入式

2013-05-06 20:35:42

#include
static single=1;
static single1=1;
unsigned char smg[]={0xfe,0xfc,0xfd,0xf9,0xfb,0xf3,0xf7,0xf6};
void delay0()
{
   unsigned t=80;
   while(t--);
}
void delay1()       
{
   unsigned t=200;
   while(t--);
}
void main()
{  
   char i;
  TCON=0x05;
  IP=0x01;
  IE=0x85;
   
while(1)
{
if(single1==1)
{
  if(single==1)
  {
  for(i=0;i<8;i++)
    {
P1=smg[i];
delay0();
}
}
else
  {
  for(i=0;i<8;i++)
    {
P1=smg[i];
delay1();
}

         }
 else;
   }
}
   


void zd() interrupt 0 

  single=!single;
  
}
void zd1() interrupt 2 

  single1=!single1;
  
}
c:
.zip
阅读(1024) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~