/********************************************************************/
//上電復(fù)位
/********************************************************************/
void LCD_Reset(void)
{? ?? ?
? ? _delay_ms(120);// Delay_Nms(120); // Delay_Nus 120ms 等待上電復(fù)位
? ? 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);??/*光標(biāo)的移動(dòng)方向*/
??wr_lcd (comm,0x0c);??/*開顯示,關(guān)光標(biāo)*/
??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);
??}
}