赞
踩
- #include "REG52.h"
- unsigned char code smgduan[17]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07
- ,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};//0-9A-F
- void smxs(unsigned char mz, unsigned char w)
- {
- unsigned char Xd=0;
- P2=255;
- P2=255-smgduan[mz];
- P3=w;
- while(++Xd);
- }
- void sjh(unsigned char* a, unsigned char* b)
- { unsigned char ab = *a; *a = *b; *b = ab; }
- void main()
- {
- unsigned char jz=0,zhi=15,wei=0,sy=0,k=0,sj[]={1,4,7,8,5,2,3,6,9,9,6,8,5,7,4,0};
- while(1)
- {
- smxs(sj[7+wei],128);smxs(sj[6+wei],64);
- smxs(sj[5+wei],32);smxs(sj[4+wei],16);
- smxs(sj[3+wei],8);smxs(sj[2+wei],4);
- smxs(sj[1+wei],2);smxs(sj[0+wei],1);
- if(!++sy)
- {
- if(!wei)wei=8;else wei=0;
- if(jz<15)
- {
- if(sj[jz]>sj[zhi]){sjh(&sj[jz],&sj[zhi]);--zhi;}else --zhi;
- if(zhi==jz){zhi=15;++jz;}else;
- }
- else jz=0;
- }
- }
- }
缘由使用keil编写程序,并且能在proteus上运行_编程语言-CSDN问答
- #include "REG52.h"
- #include <stdlib.h> //用于随机数生成函数
- unsigned char code smgduan[17]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07
- ,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};//0-9A-F
- void smxs(unsigned char mz, unsigned char w)
- {
- unsigned char Xd=0;
- P2=255;
- P2=255-smgduan[mz];
- P3=w;
- while(++Xd);
- }
- void sjh(unsigned char* a, unsigned char* b)
- { unsigned char ab = *a; *a = *b; *b = ab; }
- void main()
- {
- unsigned char jz=0,zhi=15,wei=0,sy=0,k=0,sj[16]{},x=16;
- while(1)
- {
- if(x)
- {
- if(!++sy)if(!++k)
- {
- --x;
- sj[x]=rand()*rand()%10;
- }
- }
- else
- {
- smxs(sj[7+wei],128);smxs(sj[6+wei],64);
- smxs(sj[5+wei],32);smxs(sj[4+wei],16);
- smxs(sj[3+wei],8);smxs(sj[2+wei],4);
- smxs(sj[1+wei],2);smxs(sj[0+wei],1);
- if(!++sy)
- {
- if(!wei)wei=8;else wei=0;
- if(jz<15)
- {
- if(sj[jz]>sj[zhi]){sjh(&sj[jz],&sj[zhi]);--zhi;}else --zhi;
- if(zhi==jz){zhi=15;++jz;}else;
- }
- else jz=0;
- }}
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。