⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lcd_init.c

📁 这是我在s3c44b0上移植成功的ucgui源码包
💻 C
字号:
#include "LCDConf.h"
#include "LCD.h"
#include "44blib.h"
#include "44b.h"


//SCR_XSIZE,SCR_YSIZE,LCD_XSIZE,LCD_YSIZE are defined in lcd.h

#define M5D(n) ((n) & 0x1fffff)
#define ARRAY_SIZE	(SCR_XSIZE*SCR_YSIZE)
#define HOZVAL		(LCD_XSIZE*3/8-1)
#define LINEVAL			    (LCD_YSIZE-1)
#define MVAL			    (13)
#define CLKVAL 		(5) //MCLK=30Mhz 
#define MVAL_USED 0
#define LCD_BUF_SIZE (SCR_XSIZE * SCR_YSIZE)



//unsigned int (*frameBuffer256)[SCR_XSIZE];
  unsigned int  frameBuffer256[ARRAY_SIZE];

void s3c44b0x_LCD_Init(void)
{
    
     
       
	/*if((U32)frameBuffer256==0)
	{
	    //The total frame memory should be inside 4MB.
	    //For example, if total memory is 8MB, the frame memory 
	    //should be in 0xc000000~0xc3fffff or c400000~c7fffff.
	    //But, the following code doesn't meet this condition(4MB) 
	    //if the code size & location is changed..
	    frameBuffer256=(unsigned int (*)[SCR_XSIZE])malloc(ARRAY_SIZE); 
	}*/
          // 0 2 M 1 3 C
	rLCDCON1=(0)|(2<<5)|(MVAL_USED<<7)|(0x0<<8)|(0x3<<10)|(CLKVAL<<12);
	    // disable,8B_SNGL_SCAN,WDLY=8clk,WLH=16clk,
	rLCDCON2=(LINEVAL)|(HOZVAL<<10)|(50<<21);  
	    //LINEBLANK=560 (without any calculation) 
        rLCDCON3=0x0;
	rLCDSADDR1= (0x3<<27) | ( ((U32)frameBuffer256>>22)<<21 ) | M5D((U32)frameBuffer256>>1);
	    // 256-color, LCDBANK, LCDBASEU
	rLCDSADDR2= M5D((((U32)frameBuffer256+(SCR_XSIZE*LCD_YSIZE))>>1)) | (MVAL<<21)|(1<<29);
	rLCDSADDR3= (LCD_XSIZE/2) | ( ((SCR_XSIZE-LCD_XSIZE)/2)<<9 );

	//The following value has to be changed for better display.

	rREDLUT  =0xfdb96420;
	rGREENLUT=0xfdb96420;
	rBLUELUT =0xfb40;

	rDITHMODE=0x12210;
	rDP1_2 =0xa5a5;      
	rDP4_7 =0xba5da65;
	rDP3_5 =0xa5a5f;
	rDP2_3 =0xd6b;
	rDP5_7 =0xeb7b5ed;
	rDP3_4 =0x7dbe;
	rDP4_5 =0x7ebdf;
	rDP6_7 =0x7fdfbfe;

	rLCDCON1=(1)|(2<<5)|(MVAL_USED<<7)|(0x0<<8)|(0x3<<10)|(CLKVAL<<12);
	    // enable,8B_SNGL_SCAN,WDLY=8clk,WLH=8clk,


	
    	
}





void s3c44B0x_Lcd_On(void)
{
	//Delay(5000);
    rPDATC = ( rPDATC | (1<<9) );
    //Delay(5000);
}

void s3c44B0xLcd_Off(void)
{
   // Delay(5000);
    rPDATC = ( rPDATC & (~(1<<9)) );
   // Delay(5000);
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -