u_printf(&LCD_Buffer[0],23);
if(iswait == 1) /* if iswait==1, then must wait for send end, else return direct ! */
while( *addr_counter);
return( *addr_counter); /* return number of left char will not send */ }
int led_printf(char *buf, int iswait) { volatile int *addr_counter; int j;
addr_counter = (int *)UART_COUNTER;
/* if buf=\ for(j=0;j<8;j++) { if(*buf == '\\0')
LED_Buffer[11-j]=0xf; else { if( *buf == ' ')
{ LED_Buffer[11-j]=0xf; buf++; } else
{ if( *buf <= '9')
LED_Buffer[11-j]= *buf++ & 0xf; else
LED_Buffer[11-j]= *buf++-'a'+0xa; }
} }
LED_Buffer[12]=0x88; LED_Buffer[13]=0x99;
u_printf(&LED_Buffer[0],14);
if(iswait == 1) /* if iswait==1, then must wait for send end, else return direct ! */
while( *addr_counter);
return( *addr_counter); /* return number of left char will not send }
*/
void key_shown(char key) { char buf[3]; int noshow=0;
switch(key) {
case 59: /* ESC */ IsQuitKey=1; return;
case 60: /* '4' */ strcpy(buf,\4\ break;
case 61: strcpy(buf,\8\ break; case 62: strcpy(buf,\C\ break; case 51: /* '1' */ strcpy(buf,\1\ break;
case 52: /* '5' */ strcpy(buf,\5\ break;
case 53: /* '9' */ strcpy(buf,\9\ break;
case 54: strcpy(buf,\D\ break;
case 43: /* '2' */ strcpy(buf,\2\ break;
case 44: /* '6' */ strcpy(buf,\6\ break;
case 45: /* 'a' */ strcpy(buf,\A\ break; case 46: strcpy(buf,\E\
break; case 35: /* '3' */
strcpy(buf,\3\ break;
case 36: /* '7' */ strcpy(buf,\7\ break;
case 37: /* 'b' */ strcpy(buf,\B\ break;
case 38: strcpy(buf,\F\
break; case 29: /* '+' */ strcpy(buf,\+\ break;
case 21: /* '-' */ strcpy(buf,\-\ break;
case 13: /* 'x' */ strcpy(buf,\X\ break; case 5:
strcpy(buf,\/\
break; case 30: /* '0' */ strcpy(buf,\0\ break;
case 22: /* '.' */ strcpy(buf,\.\ break;
case 14: /* ';' */ strcpy(buf,\=\ break;
case 6: /* RUN key noshow=1; break; default: noshow=1;
break; }
if( noshow == 1) return;
*/ lcd_printf(NowLine,NowCol,buf,0);
int key_choose(char key) { char buf[3]; int key_code;
switch(key)
{
case 59: /* ESC */ IsQuitKey=1; return('Q'); case 51: /* '1' */ strcpy(buf,\ key_code=1; break; case 43: /* '2' */ strcpy(buf,\ key_code=2; break;
case 35: /* '3' */ strcpy(buf,\ key_code=3; break;
case 60: /* '4' */ strcpy(buf,\ key_code=4; break;
case 52: /* '5' */ strcpy(buf,\ key_code=5; break; default: return(-1); }
lcd_printf(4,6,buf,1); mydelay();
return(key_code); }
//mydelay1(); /* wait MCU to shown */ NowCol++;
if((NowCol%8) == 0)
{ NowCol=0; NowLine++; }
}
相关推荐: