** 修改人:
** 日 期:
**-------------------------------------------------------------------------------
*********************************************************************************/
void Test_LCDBF(void)
{
uint8 temp,ErrorTime;
ErrorTime = 0xff;
do
{
temp = ReadLCDCR();
ErrorTime--;
if(ErrorTime == 0)
break;
}
while(temp & 0x80);
}
/*******************************************************************************
** 函数名称: LCDInit
** 功能描述: LCD初始化
**
** 输 入: 无
**
** 输 出: 无
**
** 全局变量: 无
** 调用模块: WriteLCDCR
**
** 作 者:
** 日 期: 2007年4月19日
**-------------------------------------------------------------------------------
** 修改人:
** 日 期:
**-------------------------------------------------------------------------------
*********************************************************************************/
void LCDInit(void)
{
uint8 code custom_character[8][8] =
{/*自定义5X8字符*/
0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*自定义字符1*/
0x00,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,/*自定义字符2*/
0x00,0x00,0x1f,0x00,0x00,0x00,0x00,0x00,/*自定义字符3*/
0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x00,/*自定义字符4*/
0x00,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,/*自定义字符5*/
0x00,0x00,0x00,0x00,0x00,0x1f,0x00,0x00,/*自定义字符6*/
0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00,/*自定义字符7*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f /*自定义字符8*/
};
uint8 i,j;
Test_LCDBF();
WriteLCDCR(0x38);
for(i=0x20; i>0; i--);
for(j=0xff; j>0; j--);
Test_LCDBF();
WriteLCDCR(0x38);
for(i=0x20; i>0; i--);
for(j=0xff; j>0; j--);
Test_LCDBF();
WriteLCDCR(0x38);
for(i=0x20; i>0; i--);
for(j=0xff; j>0; j--);
Test_LCDBF();
WriteLCDCR(0x06);
Test_LCDBF();
WriteLCDCR(0x0c);
Test_LCDBF();
WriteLCDCR(0x01);
Test_LCDBF();
WriteLCDCR(0x40);
for(i=0; i<=7; i++)
{
for(j=0; j<=7; j++)
{
Test_LCDBF();
WriteLCDDR(custom_character[i][j]);
}
}
}
/*******************************************************************************
** 函数名称: LCDDisplay
** 功能描述: LCD上显示字符串
**
** 输 入: *string(指向字符串地址),position(显示位置)
**
** 输 出: 无
**
** 全局变量: 无
** 调用模块: WriteLCDCR,WriteLCDDR,Test_LCDBF
**
** 作 者:
** 日 期: 2007年4月19日
**-------------------------------------------------------------------------------
** 修改人:
** 日 期:
**-------------------------------------------------------------------------------
*********************************************************************************/
void LCDDisplay(uint8 *string,uint8 position)
{
Test_LCDBF();
WriteLCDCR(position);
while(*string != ’#’)
{
if(position == 0x90)
{
Test_LCDBF();
WriteLCDCR(0xC0);
position = 0xC0;
}
/*if(*string == ’\0’)
*string = ’ ’; */
Test_LCDBF();
WriteLCDDR(*string++);
position++;
if(position > 0xCF)
{
Test_LCDBF();
WriteLCDCR(0x80);
position = 0x80;
}
}
}
/*******************************************************************************
** 函数名称: Timer0_IRQ
** 功能描述: 定时器0中断服务程序
**
** 输 入: 无
**
** 输 出: 无
**
** 全局变量:
** 调用模块: 无
**
** 作 者:
** 日 期: 2007年4月19日
**-------------------------------------------------------------------------------
** 修改人:
** 日 期:
**-------------------------------------------------------------------------------
*********************************************************************************/
void Timer0_IRQ(void) interrupt 1 using 1
{
TH0 = 0x3c;
上一页 [1] [2] [3] [4] 下一页
本文关键字:智能 控制系统 51单片机,单片机-工控设备 - 51单片机