|
 ;********WAVE-E6000/T************************** ;*MCU: AT89C51 * ;*MCU-crystal: 6M * ;*Version: 00 * ;*Last Updata: * ;*Author: www.picavr.com * ;*Description: 三十七選一 * ;**********************************************
#include <reg51.h> unsigned int i,j,k; unsigned char a; unsigned char led[16]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8, 0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e}; void delay(i) { while(i--) { j=7650;while(j--);} } /* 顯示當前循環(huán)變量 3 秒鐘 */ void stop(void) { P0=led[a/10];P2=led[a%10]; delay(30); } /* 中斷函數(shù) */ void key_int0() interrupt 0 { stop();} void main(void) { P0=0x80;P2=0x80;delay(10);P0=0xff;P2=0xff; P1=0xfe; IE=0x81; while(1) { for(a=1;a<=37;a++) { P0=led[(a*3+1)%16];P2=led[(a*5+1)%16]; /* 顯示亂碼 */ delay(1); } } }
|