Ä¿¹Â´ÏƼ>ÀÚ·á½Ç
   
   
 
    Èæ¹é Graphic LCD Interface   2013.01.25
    Èæ¹é Graphic LCD Interface
   
 

void LcdInitalize(void)
{
nLCD_NSS=1;
Delay_ms(130);
LcdInstWrite(0x38);
// LcdInstWrite(0x30);
// Delay_us(100);
// LcdInstWrite(0x30);
LcdInstWrite(0x3C);
LcdInstWrite(LR_DISPLAY); //display off
LcdInstWrite(0x01); //clear display
Delay_ms(2);
LcdInstWrite(0x06); //entry mode select
LcdInstWrite(LR_DISPLAY|L_DISPLAYON); //display on // Cursor off

memset(LcdBuf,0,17);
//1234567890123456
sprintf(LcdBuf,"TEST LINE #1 \0");
LcdWriteStr(0,LcdBuf,0);

memset(LcdBuf,0,17);
//1234567890123456
sprintf(LcdBuf,"TEST LINE #2 \0");
LcdWriteStr(1,LcdBuf,0);

}

void CourserCtl(BYTE Mode,BYTE line,BYTE start)
{
BYTE j;
if(line) j=(LR_DDRAM_ADDR|0x40|start);
else j= LR_DDRAM_ADDR|start;
LcdInstWrite(j);
if(Mode==1){
LcdInstWrite(LR_DISPLAY|L_DISPLAYON|L_CURSOR); //display on // Cursor on
}
else LcdInstWrite(LR_DISPLAY|L_DISPLAYON); //display on // Cursor off
}

void LcdReturnHome(void)
{
LcdInstWrite(0x02);
Delay_ms(2);

}

void LcdInstWrite(BYTE val)
{
LCD_RS=0; //data write
LCD_RW=0;
LCD_EN =1;
PORTC=val;
LCD_EN =0;
Delay_us(40);
}

void LcdDataWrite(BYTE val)
{
LCD_RS=1; //data write
LCD_RW=0;
LCD_EN =1;
PORTC=val;
LCD_EN =0;
Delay_us(40);
}

void LcdWriteStr(BYTE line,BYTE *str,BYTE start)
{
BYTE i,j;
LcdReturnHome();
if(line) j=(LR_DDRAM_ADDR|0x40|start);
else j= LR_DDRAM_ADDR|start;
LcdInstWrite(j);
while(*str){
i=*str;
LcdDataWrite(*str);
str++;
}
}

void LcdWritePosition(BYTE line,BYTE pos,BYTE val)
{
BYTE addr;
addr= LR_DDRAM_ADDR|pos;
if(line) addr|=0x40;
LcdInstWrite(addr);
LcdDataWrite(val);
}


 
 
   
 
ÁÖ¼Ò: ÀÎõ±¤¿ª½Ã ¼­±¸ ºÀ¼ö´ë·Î 141 °¡Á½ùü°ø´Ü Bµ¿ 505È£    ´ëÇ¥ÀÚ : ±è½Ã¼®    ÀüÈ­¹øÈ£ : 032)672-2966    Æѽº¹øÈ£ : 032)672-2965
»ç¾÷ÀÚµî·Ï ¹øÈ£ : 225-14-00080    ÄÜÆ®·Ñ·¯°³¹ß,ÀüÀÚÁ¦Ç°°³¹ß ¾ÆÅ×Å©