線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1381
推到 Plurk!
推到 Facebook!

點矩陣320x240(RA8835A/VA3202401)無法點亮

缺席
phchen0413
一般會員


發表:14
回覆:21
積分:12
註冊:2009-07-01

發送簡訊給我
#1 引用回覆 回覆 發表時間:2012-07-10 12:25:12 IP:211.75.xxx.xxx 訂閱
請問各位大大,小弟目前使用C8051F342去點此點矩陣LCD,但不知為何其畫面總是無顯示出來,
因此不知哪邊有出問題,附上小弟的code和spec.請大大不吝說明,謝謝!

void Initial_LCD(void); //Initial LCD
void WriteCommand_LCD(unsigned char WCLCD); //Write Command to LCD
void WriteData_LCD(unsigned char WDLCD); //Write Data to LCD
void LCD_Clear_ALL_RAM(void);//Clear All RAM
void LCD_Clear_First(void); //Clear First Memory Layer
void LCD_Clear_Second(void); //Clear Second Memory Layer
void LCD_CSRW(unsigned int CSRW_D); //CSRW
void LCD_Display_Text(void);//LCD Display Text

void main()
{
LCD_RST=1; // RESET=1
T0_Wait_ms(280); // Waiting LCD Ready for 40ms
Initial_LCD(); // Initialize LCD
LCD_Display_Text(); // LCD Display Text
}

void Initial_LCD(void)
{
WriteCommand_LCD(0x40); //SYSTEM SET Command
WriteData_LCD(0x30); //P1
WriteData_LCD(0x87); //P2,FX
WriteData_LCD(0x07); //P3,FY
WriteData_LCD(0x27); //P4,CR
WriteData_LCD(0x2F); //P5,TC/R
WriteData_LCD(0xEF); //P6,L/F
WriteData_LCD(0x28); //P7,APL
WriteData_LCD(0x00); //P8,APH
WriteCommand_LCD(0x44);//SCROLL Command
WriteData_LCD(0x00); //P1,SAD_1L
WriteData_LCD(0x00); //P2,SAD_1H
WriteData_LCD(0xF0); //P3,SL1
WriteData_LCD(0x80); //P4,SAD_2L
WriteData_LCD(0x25); //P5,SAD_2H
WriteData_LCD(0xF0); //P6,L_F
WriteData_LCD(0x00); //P7,SAD_3L
WriteData_LCD(0x4B); //P8,SAD_3H
WriteData_LCD(0x00); //P9,SAD_4L
WriteData_LCD(0x00); //P10,SAD_4H
WriteCommand_LCD(0x5A);//HDOT SCR Command
WriteData_LCD(0x00); //P1,NO SCROLL
WriteCommand_LCD(0x5B);//OVLAY Command
WriteData_LCD(0x01); //P1,GRAPHIC & OR
WriteCommand_LCD(0x58);//DISP OFF Command
WriteData_LCD(0x56);
LCD_Clear_ALL_RAM();//Clear All RAM Command
LCD_CSRW(0);//CSRW Command
WriteCommand_LCD(0x5D);//CSR Form
WriteData_LCD(0x04);
WriteData_LCD(0x86);
WriteCommand_LCD(0x59);//DISP ON
LCD_Display_Text();
}

void WriteCommand_LCD(unsigned char WCLCD)
{
LCD_DB=WCLCD;
LCD_RD=1;
LCD_WR=0;
LCD_A0=1;
LCD_CS=0;
T0_Wait_ms(10);
LCD_CS=1;
T0_Wait_ms(10); //等訊號處裡完畢
}

void WriteData_LCD(unsigned char WDLCD)
{
LCD_DB=WDLCD;
LCD_RD=1;
LCD_WR=0;
LCD_A0=0;
LCD_CS=0;
T0_Wait_ms(10);
LCD_CS=1;
T0_Wait_ms(10); //等訊號處裡完畢
}

void LCD_Clear_ALL_RAM()
{
LCD_Clear_First();
LCD_Clear_Second();
}

void LCD_Clear_First()
{
LCD_CSRW(0);
WriteCommand_LCD(0x42); //MWRITE Command
for(j=0;j<1200;j ) //320/8=40,240/8=30=>40*30=1200bytes
WriteData_LCD(0x20);
}

void LCD_Clear_Second()
{
LCD_CSRW(40*240);//320/8=40,240/1=240=>40*240=9600bytes
WriteCommand_LCD(0x42); //MWRITE Command
for(j=0;j<(40*240);j )
WriteData_LCD(0x00);
}

void LCD_CSRW(unsigned int CSRW_D)
{
unsigned char DataL,DataH;
DataL=CSRW_D&0xFF; //high byte calculation
DataH=(CSRW_D>>8)&0xFF; //low byte calculation
WriteCommand_LCD(0x46); //CSRW Command
WriteData_LCD(DataL); //P1, cursor low byte
WriteData_LCD(DataH); //P2, cursor high byte
}

void LCD_Display_Text(void)
{
LCD_CSRW(40*11 14);
WriteCommand_LCD(0x42);// MWRITE Command
WriteData_LCD('P');
}


附加檔案:4ffbaea8c1657_RA8835A.pdf
編輯記錄
phchen0413 重新編輯於 2012-07-12 21:42:41, 註解 無‧
phchen0413 重新編輯於 2012-07-12 21:43:17, 註解 無‧
phchen0413
一般會員


發表:14
回覆:21
積分:12
註冊:2009-07-01

發送簡訊給我
#2 引用回覆 回覆 發表時間:2012-07-12 19:30:58 IP:211.75.xxx.xxx 訂閱
小第已經完成可以顯示內容,提供code給有需要的伙伴們
void Reset_LCD(void); //LCD RESET
void Clear_LCD(void); //Clear LCD Screen
void MoveCursor_LCD(unsigned char X,unsigned char Y);//Move cursor position
void WriteCommand_LCD(unsigned char WCLCD); //Write Command to LCD
void WriteData_LCD(unsigned char WDLCD); //Write Data to LCD
void Initial_LCD(void); //Initial LCD
void LCD_Display_Text(void);//LCD Display Text

void main()
{
Reset_LCD(); //LCD RESET
Initial_LCD(); //Initialize LCD
LCD_Display_Text(); //Display Text
}

void Reset_LCD(void)
{
T0_Wait_ms(150);
LCD_RST=0;
T0_Wait_ms(700);
LCD_RST=1;
T0_Wait_ms(3500);
}

void Clear_LCD(void)
{
MoveCursor_LCD(0,0);
WriteCommand_LCD(0x42);
for(j=0;j<=32768;j )
WriteData_LCD(0x00);
}

void MoveCursor_LCD(unsigned char X,unsigned char Y)
{
WriteCommand_LCD(0x46);
WriteData_LCD(X);
WriteData_LCD(Y);
}

void WriteCommand_LCD(unsigned char WCLCD)
{
LCD_DB=WCLCD;
LCD_A0=1;
LCD_CS=0;
LCD_WR=0;
LCD_WR=1;
LCD_CS=1;
}

void WriteData_LCD(unsigned char WDLCD)
{
LCD_DB=WDLCD;
LCD_A0=0;
LCD_CS=0;
LCD_WR=0;
LCD_WR=1;
LCD_CS=1;
LCD_A0=1;
}

void Initial_LCD(void)
{
WriteCommand_LCD(0x40); //SYSTEM SET Command
WriteData_LCD(0x30); //P1
WriteData_LCD(0x87); //P2,FX
WriteData_LCD(0x07); //P3,FY
WriteData_LCD(0x27); //P4,CR
WriteData_LCD(0x2F); //P5,TC/R---spec.
WriteData_LCD(0xEF); //P6,L/F
WriteData_LCD(0x28); //P7,APL
WriteData_LCD(0x00); //P8,APH

WriteCommand_LCD(0x44);//SCROLL Command
WriteData_LCD(0x00); //P1,SAD_1L
WriteData_LCD(0x00); //P2,SAD_1H
WriteData_LCD(0xF0); //P3,SL1
WriteData_LCD(0x80); //P4,SAD_2L
WriteData_LCD(0x25); //P5,SAD_2H
WriteData_LCD(0xF0); //P6,L_F
WriteData_LCD(0x00); //P7,SAD_3L
WriteData_LCD(0x4B); //P8,TC/R---spec.
WriteData_LCD(0x00); //P9,SAD_4L
WriteData_LCD(0x00); //P10,SAD_4H---spec.

WriteCommand_LCD(0x5A);//HDOT SCR Command
WriteData_LCD(0x00); //P1,NO SCROLL

WriteCommand_LCD(0x5B);//OVLAY
WriteData_LCD(0x01);//spec.

WriteCommand_LCD(0x58);//DISP OFF Command
WriteData_LCD(0x56); //---spec.

Clear_LCD(); //Clear LCD Screen

WriteCommand_LCD(0x5D);//CSR Form
WriteData_LCD(0x04);//spec.
WriteData_LCD(0x86);//spec.

WriteCommand_LCD(0x59);//DISP ON
WriteCommand_LCD(0x4C);//CSR DIR
}

void LCD_Display_Text(void)
{
MoveCursor_LCD(0,0);
WriteCommand_LCD(0x42);//MWRITE
WriteData_LCD('A');
WriteData_LCD('B');
WriteData_LCD('C');
}
系統時間:2024-11-21 19:14:25
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!