MARK-数码管循环显示内容(编写时注意宏定义的out
)
#include "reg51.h"
#include "intrins.h"
#define uchar unsigned char
#define uint unsigned int
#define out P0
uchar code seg[] = {0xc0,0xa4,0x99,0x82,0x80,0xf9,0xb0,0x92,0xf8,0x90,0x01};
void delay(unsigned int xms)
{
unsigned int x,y;
for(x=xms;x>0;x--)
for(y=110;y>0;y--);
}
void main(){
uchar i;
while(1){
out = seg[i];
delay(900);
i++;
if(seg[i]==0x01) i=0;
}
}