void LcdWriteStr(int line, char s[]) {
  int i;
  if (line == 1) LcdCommandWr(0x80);         // Set display address for line 1
  if (line == 2) LcdCommandWr(0xA8);         // Set display address for line 2
  for(i=0;i<=DISPLAYSIZE && s[i];i++)        // Send only max chars to display
    LcdPutChar(s[i]);                        // when the given string is longer
}
예제 #2
0
파일: main.c 프로젝트: zzy-driver/usb
/********************************************************************
函数功能:在LCD上显示按键情况。
入口参数:无。
返    回:无。
备    注:无。
********************************************************************/
void DispKey(void)
{
 int i;

 for(i=0;i<6;i++)
 {
  LcdSetPoint(0,0);
  if(KeyDown&(1<<i))
  {
   LcdPrints("Key ");
   LcdPutChar('1'+i);
   LcdPrints(" down  ");
  }
  LcdSetPoint(0,0);
  if(KeyUp&(1<<i))
  {
   LcdPrints("Key ");
   LcdPutChar('1'+i);
   LcdPrints(" up    ");
  }
 }
}
void main() {
  void brdInit();                            // Enable development board
  SetPortAOut();                             // Set port A as output port
  WrPortI(PBDDR, &PBDDRShadow, 0xFF);        // Set port B as output port

  Lcd_Config();
  pause(5);

  LcdWriteStr(1,"Rabbit-RCM4010:");
  pause(5);

  LcdWriteStr(2,"[\"Hello World!\"]");
  pause(10);

  Lcd_Clear();
  Lcd_noCursor_On();
  LcdWriteStr(1,"LCD off in 5 sec");
  LcdCommandWr(0xA8);
  MsDelay(300); LcdPutChar('5');
  MsDelay(300); LcdPutChar('.');
  MsDelay(300); LcdPutChar('.');
  MsDelay(300); LcdPutChar('4');
  MsDelay(300); LcdPutChar('.');
  MsDelay(300); LcdPutChar('.');
  MsDelay(300); LcdPutChar('3');
  MsDelay(300); LcdPutChar('.');
  MsDelay(300); LcdPutChar('.');
  MsDelay(300); LcdPutChar('2');
  MsDelay(300); LcdPutChar('.');
  MsDelay(300); LcdPutChar('.');
  MsDelay(300); LcdPutChar('1');
  MsDelay(300); LcdPutChar('.');
  MsDelay(300); LcdPutChar('.');
  MsDelay(300); LcdPutChar('0');
  MsDelay(300); Lcd_Off();
}