#include<reg51.h> #include<intrins.h> voiddisplay(unsigned char *lp,unsigned char lc); voiddisplaystr(unsigned char *lp,unsigned char lc); void delay(); codeunsigned chartable[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x40,0x00}; unsignedchar l_tmpdate[8]={0,1,2,3,4,5,6,7}; codeunsigned char l_64C0F[5]={0x5B,0x7D,0x5E,0x3F,0x7F}; voidmain(void) { unsigned char i=0; while(1) { //display(l_tmpdate,8); displaystr(l_64C0F,5); } } voiddisplay(unsigned char *lp,unsigned char lc) { unsigned char i; P2=0; P1=P1&0xF8; for(i=0;i<lc;i++) { P2=table[lp]; delay(); if(i==7) break; P2=0; P1++;}} voiddisplaystr(unsigned char *lp,unsigned char lc)//ÏÔê¾ { unsigned char i; P2=0; P1=P1&0xF8; for(i=0;i<lc;i++) { P2=lp; delay(); if(i==7) break; P2=0; P1++;}} voiddelay(void)//¿Õ5¸öÖ¸áî { _nop_();_nop_();_nop_();_nop_();_nop_(); }
|