- #include "reg52.h"
- sbit k1=P3^0;//启动
- sbit k2=P3^1;//暂停
- void main()
- {//缘由
- unsigned char sy=0,my=0,m=0,xd=0,qh=0;
- bit kz=0;
- P0=P1=P2=P3=255;
- while(1)
- {
- if(kz)if(++sy==0)if(++my==0)
- {
- if(qh<10)P1=255-m;
- else if(qh>9&&qh<19)P0=255-m;
- else if(qh>18&&qh<28)P2=255-m;
- else if(qh>27)P3=255-m;
- if(m==0)m=1;else m*=2;
- if(++qh>36)m=qh=0;
- }
- if(qh!=29&&k1==0&&++xd==0){kz=1;while(k1==0);}
- if(qh!=30&&k2==0&&++xd==0){kz=0;while(k2==0);}
- }
- }
复制代码
|