/********************************************************************/
//上电复位
/********************************************************************/
void LCD_Reset(void)
{
_delay_ms(120);// Delay_Nms(120); // Delay_Nus 120ms 等待上电复位
PORTD =(1<
//PORTD =0xff;//lcd_control = 0xff; // LCD_RS/WR/RD/CS1/CS2 normal - skeep high.
_delay_ms(120);
ClrLCD_RS;
// _delay_ms(120);
}
/********************************************************************/
//LCD初始化
/********************************************************************/
void LCD_Initial(void)
{
ClrLCD_E;//e=0;
wr_lcd (comm,0x01); /*清屏,地址指针指向00H*/
wr_lcd (comm,0x06); /*光标的移动方向*/
wr_lcd (comm,0x0c); /*开显示,关光标*/
wr_lcd (comm,0x38); /*8位接口两行显示模式*/
}
void wr_lcd (unsigned char dat_comm,unsigned char content)
{
if(dat_comm)
{
SetLCD_RS;//rs=1; //data
ClrLCD_WR;//rw=0; //write
}
else
{
ClrLCD_RS;//rs=0; //command
ClrLCD_WR;//rw=0; //write
}
PORTC = content; //output data or comm
SetLCD_E;//e=1;
_delay_ms(1);//delay(1);
ClrLCD_E;//e=0;
}
void chrt_disp (unsigned char *chrt)
{
uchar i,j;
wr_lcd (comm,0x80);
for (j=0;j<2;j++)
{
for (i=0;i<16;i++)
wr_lcd (dat,chrt[j*16+i]);
wr_lcd (comm,0xc0);
}
}