커뮤니티>자료실
   
   
 
    흑백 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    콘트롤러개발,전자제품개발 아테크