|||
//8个发光管演示出8位二进制数累加过程
#include <intrins.h>
#include <reg52.h>
#define uint unsigned int
#define uchar unsigned char
void delay(uint);
uchar temp,temp2;
void main()
{
temp=0xff;
temp2=0x0;
P1=temp;
while(1)
{
delay(30);
temp2++;
P1=~temp2;
}
}
void delay(uint z)
{
uint x, y;
for(x=z;x>0;x--)
for(y=765;y>0;y--) {}
}
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-23 06:09
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社