⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lcd7920.c.bak

📁 LCD7920汉字液晶操作程序
💻 BAK
📖 第 1 页 / 共 2 页
字号:
  }
}
/*******************************************************************************************
*                                                                                          *
* Function:uchar LCD_Print_Chr(uchar _ROW,uchar _COL, uchar PT)                            *
*                                                                                          *
* Input:        -_ROW--起始行号                                                            *
*                _COL--起始列号                                                            *
*                _字符串指针                                                               *
* Output:       -                                                                          *
*                                                                                          *
* Description:  显示一个字符.                                                              *
*                                                                                          *
*******************************************************************************************/
void LCD_Print_Chr(uchar _ROW,uchar _COL, uchar PT)
{
  uint data itmp;
  uchar data count;
  uchar data Tmp_Array[3];
  //计算显示首址
  itmp=_ROW*0x10+_COL;
  count=0;
  Tmp_Array[0]=(uchar) itmp;
  Tmp_Array[1]=(uchar) (itmp>>8);
  Tmp_Array[2]=0x24;  //设置显示存储器首址
  LCD_LCD_Send_CMD(Tmp_Array);
  Tmp_Array[1]=PT-0x20;
  Tmp_Array[2]=0xC4;  //设置显示存储器首址
  LCD_LCD_Send_CMD(Tmp_Array);
}
/*******************************************************************************************
*                                                                                          *
* Function:uchar LCD_Print_HEX(uchar _ROW,uchar _COL, uchar _DATA)                         *
*                                                                                          *
* Input:        -_ROW--起始行号                                                            *
*                _COL--起始列号                                                            *
*                _DATA-要打印的数据                                                        *
* Output:       -                                                                          *
*                                                                                          *
* Description:  显示字符串.                                                                *
*                                                                                          *
*******************************************************************************************/
void LCD_Print_HEX(uchar _ROW,uchar _COL, uchar _DATA)
{
  uint data itmp;
  uchar data count;
  uchar data Tmp_Array[3];
  //计算显示首址
  itmp=_ROW*0x10+_COL;
  count=0;
  Tmp_Array[0]=(uchar) itmp;
  Tmp_Array[1]=(uchar) (itmp>>8);
  Tmp_Array[2]=0x24;  //设置显示存储器首址
  LCD_LCD_Send_CMD(Tmp_Array);
  count=_DATA>>4;
  if (count>0x09)
   count=count+0x17;
  else
   count=count+0x10;
  Tmp_Array[1]=count;
  Tmp_Array[2]=0xC0;  //设置显示存储器首址
  LCD_LCD_Send_CMD(Tmp_Array);
  count=_DATA & 0x0F;
  if (count>0x09)
   count=count+0x17;
  else
   count=count+0x10;
  Tmp_Array[1]=count;
  Tmp_Array[2]=0xC0;  //设置显示存储器首址
  LCD_LCD_Send_CMD(Tmp_Array);
}
/*******************************************************************************************
*                                                                                          *
* Function:void LCD_Send_CMD(uchar _Cmd)                                                       *
*                                                                                          *
* Input:        -                                                                          *
* Output:       -                                                                          *
*                                                                                          *
* Description:  对LCD写入指令.                                                             *
*                                                                                          *
*******************************************************************************************/
void LCD_Send_CMD(uchar _Cmd)
{
	RS=false;
	P0=_Cmd;
	RnW=false;
	E=true;
	_nop_();
	E=false;
}
/*******************************************************************************************
*                                                                                          *
* Function:void LCD_Send_Data(uchar _Data)                                                     *
*                                                                                          *
* Input:        -                                                                          *
* Output:       -                                                                          *
*                                                                                          *
* Description:  对LCD写入数据.                                                             *
*                                                                                          *
*******************************************************************************************/
void LCD_Send_Data(uchar _Data)
{
	RS=true;
	P0=_Data;
	RnW=false;
	E=true;
	_nop_();
	E=false;
}
/*******************************************************************************************
*                                                                                          *
* Function:uchar LCD_Read_CMD(void)                                                            *
*                                                                                          *
* Input:        -                                                                          *
* Output:       -                                                                          *
*                                                                                          *
* Description:  对LCD写入指令.                                                             *
*                                                                                          *
*******************************************************************************************/
uchar LCD_Read_CMD(void)
{
	uchar Btmp;
	RnW=true;
	RS=false;
	Btmp=P0;
	E=true;
	_nop_();
	Btmp=P0;   //哑读
	E=false;
  _nop_();
	E=true;
	_nop_();
	Btmp=P0;
	E=false;
  return(Btmp);
}
/*******************************************************************************************
*                                                                                          *
* Function:uchar LCD_Read_Data(void)                                                            *
*                                                                                          *
* Input:        -                                                                          *
* Output:       -                                                                          *
*                                                                                          *
* Description:  对LCD写入指令.                                                             *
*                                                                                          *
*******************************************************************************************/
uchar LCD_Read_Data(void)
{
	uchar Btmp;
	RnW=true;
	RS=true;
	Btmp=P0;
	E=true;
	_nop_();
	Btmp=P0;
	E=false;
  _nop_();
	E=true;
	_nop_();
	Btmp=P0;
	E=false;
  return(Btmp);
}

⌨️ 快捷键说明

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