dc550_display.c

来自「一款经典的数字电话设计资料」· C语言 代码 · 共 1,767 行 · 第 1/5 页

C
1,767
字号
  for(i = 48; i > 0; i--);

  // Write the sixth line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x11;                 // Sixth line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the seventh line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x1F;                 // Seventh line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the eighth line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x00;                 // Eighth line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low
}


/******************************************************************************
 *  FUNCTION: void display_util_chartop_fullbox(void)
 ******************************************************************************
 *  DESCRIPTION:
 *  This function programs the top of the full box character into CGRAM.
 *****************************************************************************/
void display_util_chartop_fullbox(void) {
  // Declare local variable
  int i;

  // Write the first line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x1F;                 // First line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the second line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x1F;                 // Second line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the third line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x1F;                 // Third line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the fourth line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x1F;                 // Fourth line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low
}


/******************************************************************************
 *  FUNCTION: void display_util_charbottom_fullbox(void)
 ******************************************************************************
 *  DESCRIPTION:
 *  This function programs the bottom of the full box character into CGRAM.
 *****************************************************************************/
void display_util_charbottom_fullbox(void) {
  // Declare local variable
  int i;

  // Write the fifth line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x1F;                 // Fifth line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the sixth line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x1F;                 // Sixth line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the seventh line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x1F;                 // Seventh line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the eighth line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x00;                 // Eighth line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low
}


/******************************************************************************
 *  FUNCTION: void display_util_chartop_uparrow(void)
 ******************************************************************************
 *  DESCRIPTION:
 *  This function programs the top of the up arrow character into CGRAM.
 *****************************************************************************/
void display_util_chartop_uparrow(void) {
  // Declare local variable
  int i;

  // Write the first line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x04;                 // First line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the second line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x0E;                 // Second line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the third line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x15;                 // Third line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the fourth line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x04;                 // Fourth line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low
}


/******************************************************************************
 *  FUNCTION: void display_util_charbottom_uparrow(void)
 ******************************************************************************
 *  DESCRIPTION:
 *  This function programs the bottom of the up arrow character into CGRAM.
 *****************************************************************************/
void display_util_charbottom_uparrow(void) {
  // Declare local variable
  int i;

  // Write the fifth line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x04;                 // Fifth line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the sixth line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x04;                 // Sixth line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the seventh line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x04;                 // Seventh line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the eighth line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x00;                 // Eighth line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low
}


/******************************************************************************
 *  FUNCTION: void display_util_chartop_downarrow(void)
 ******************************************************************************
 *  DESCRIPTION:
 *  This function programs the top of the down arrow character into CGRAM.
 *****************************************************************************/
void display_util_chartop_downarrow(void) {
  // Declare local variable
  int i;

  // Write the first line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x04;                 // First line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the second line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x04;                 // Second line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the third line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x04;                 // Third line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the fourth line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x04;                 // Fourth line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low
}


/******************************************************************************
 *  FUNCTION: void display_util_charbottom_downarrow(void)
 ******************************************************************************
 *  DESCRIPTION:
 *  This function programs the bottom of the down arrow character into CGRAM.
 *****************************************************************************/
void display_util_charbottom_downarrow(void) {
  // Declare local variable
  int i;

  // Write the fifth line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x15;                 // Fifth line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the sixth line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x0E;                 // Sixth line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the seventh line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x04;                 // Seventh line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low

 // Wait for 40 microseconds
  for(i = 48; i > 0; i--);

  // Write the eighth line
  LCDCTRL_OUT &= ~(LCD_RNW);          // Clear RNW bit
  LCDCTRL_OUT |= LCD_RS;              // Set RS bit
  LCDDATA_OUT = 0x00;                 // Eighth line
  LCDCTRL_OUT |= LCD_E;               // Clock bit high
  _NOP();
  LCDCTRL_OUT &= ~(LCD_E);            // Clock bit low
}


/******************************************************************************
 *  FUNCTION: void display_exec(void)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?