 ;********WAVE-E6000/T************************** ;*MCU: AT89C51 * ;*MCU-crystal: 6M * ;*Version: 00 * ;*Last Updata: * ;*Author: www.picavr.com * ;*Description: 查詢方式循環(huán)顯示0—99 * ;********************************************** /* 延時(shí)時(shí)間為方式1的最長(zhǎng)時(shí)間 */ #include <reg51.h> unsigned int i; unsigned char led[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8, 0x80,0x90}; void main(void) { TMOD=0x01; /* T/C0以方式1工作*/ TH0=0x00;TL0=0x00; /*計(jì)數(shù)65536次*/ TR0=1; while(1) { for(i=0;i<=99;i++) { P0=led[i/10]; P2=led[i%10]; while(!TF0){;} /* 等待定時(shí)器溢出 */ TF0=0; /* 溢出標(biāo)志清"0" */ TH0=0x00;TL0=0x00; } } } |