什么叫超过127?难道你是直接用8位内码来显示想显示的数据?
1602,是字符显示器,字符0-9是对应的字符内码。
给你看个1602的核心驱动吧:- // **************************** //
- // ***八位数据分2次写入 LCD *** //
- // **************************** //
- void LCD_WriteData (unsigned char Data)
- {
- LCD_Busy(); // 测试LCD空闲
- SET_LCD_OUT; // LCD 端口定义为输出
- LCD_WD_PORT=(Data >>4); // 输出高四位数据到LCD数据端口
- LCD_CLEAR_RW() ; // 设置LCD为写模式
- LCD_SET_RS(); // 设置LCD为数据模式
- LCD_SET_EN(); // 激活片选,写数据到LCD
- asm("nop");
- asm("nop");
- asm("nop");
- asm("nop");
- LCD_CLEAR_EN(); // 关闭LCD片选
- LCD_WD_PORT=(Data&0x0f); // 出低四位数据到LCD数据端口
- LCD_CLEAR_RW() ; // 设置LCD为写模式
- LCD_SET_RS(); // 设置LCD为数据模式
- LCD_SET_EN(); // 激活片选,写数据到LCD
- asm("nop");
- asm("nop");
- asm("nop");
- asm("nop");
- LCD_CLEAR_EN(); // 关闭LCD片选
- }
- // ****************************************************************** //
- // *** Display a single character, at the current cursor location *** //
- // ****************************************************************** //
- void LCD_DisplayCharacter (char Char)
- {
- LCD_WriteData (Char);
- }
- // ********************************************************************* //
- // *** Display a string at the specified row and column, using FLASH *** //
- // ********************************************************************* //
- void LCD_DisplayString_F (char row, char column , unsigned char __flash *string)
- {
- LCD_Cursor (row, column);
- while (*string)
- {
- LCD_DisplayCharacter (*string++);
- }
- }
- // ******************************************************************* //
- // *** Display a string at the specified row and column, using RAM *** //
- // ******************************************************************* //
- void LCD_DisplayString (char row, char column , unsigned char *string)
- {
- LCD_Cursor (row, column);
- while (*string)
- LCD_DisplayCharacter (*string++);
- }
调用过程:
定义数据:
__flash unsigned char txt_eq13[]=" Bass-boost 1 ";
显示命令:
LCD_DisplayString_F(2,1,txt_eq13);
然后显示就是: Bass-boost 1
|