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

📄 44blcd.c

📁 EG1147液晶测试程序,用于44b0开发板
💻 C
字号:
#include <string.h>
#include "..\inc\option.h"
#include "..\inc\def.h"
#include "..\inc\44b.h"
#include "..\inc\44blib.h"
#include "..\inc\lcd.h"
#include "..\inc\lcdlib.h"
#include "..\inc\44blcd.h"
#include "..\inc\PLMM.h"

void displaylcd(void);
void clrscreen(void);
void Lcd_MonoInit(void);

/*volatile char which_int=0;*/
void LcdInit(void)
{
 
  Lcd_MonoInit();
  displaylcd();
  Uart_Printf("LCD DISPLAY\n");
  Uart_Printf("Type any key to exit!!!\n");
  Uart_Getch();
}




void Lcd_MonoInit(void)
{
    //160x240 1bit/1pixel LCD
    #define MVAL_USED 0
     if((U32)frameBuffer16==0)
	{
	  if (( frameBuffer16=(unsigned int (*)[SCR_XSIZE/8])malloc(ARRAY_SIZE_G16))==NULL)
	     {
	        Uart_Printf("ERROR !!!!!!!! NO MEMERY !!!!!!! \n");
	      }
	  else 
	       {
	         Uart_Printf("ARRAY_SIZE_g16= %d \n", ARRAY_SIZE_G16);
	        }
         }

	rLCDCON1=(0)|(1<1)|(1<<5)|(MVAL_USED<<7)|(0x3<<8)|(0x3<<10)|(CLKVAL_G16<<12);
	    // disable,4B_SNGL_SCAN,WDLY=8clk,WLH=8clk,
	rLCDCON2=(LINEVAL)|(HOZVAL<<10)|(10<<21);  
	    //LINEBLANK=10 (without any calculation) 
	rLCDSADDR1= (0x2<<27) | ( ((U32)frameBuffer16>>22)<<21 ) | M5D((U32)frameBuffer16>>1);
	    // 16-lever gray  mode , LCDBANK, LCDBASEU
	rLCDSADDR2= M5D (((U32)frameBuffer16+(SCR_XSIZE*(LINEVAL+1))/2)>>1) | (MVAL<<21) |(0<<29);//MVAL
          // 4*SCR_XSIZE*LCD_YSIZE/8
	rLCDSADDR3= (LCD_XSIZE/4) | ( ((SCR_XSIZE-LCD_XSIZE)/4)<<9 );

	rLCDCON1=(1)|(1<<1)|(1<<5)|(MVAL_USED<<7)|(0x3<<8)|(0x3<<10)|(CLKVAL_G16<<12);
	    // enable,4B_SNGL_SCAN,WDLY=8clk,WLH=8clk,
    
}

void displaylcd(void)
{
   unsigned int *pbuffer,temp_data;
     int i,j=0;
    pbuffer =(U32*) frameBuffer16;
      
    clrscreen();
    for(i = 0; i< (38400/4) ;i++)
    {
       temp_data = (plmmBitmap[i*4] << 24) + (plmmBitmap[i*4+1] << 16) + (plmmBitmap[i*4+2] << 8) +(plmmBitmap[i*4+3]);
        pbuffer[i] = temp_data;

    }
}

void clrscreen(void)
{
    unsigned int *pbuffer;
     int i;
     
    pbuffer =(U32*) frameBuffer16;
    for(i = 0; i< (38400/4) ;i++)
    {
        pbuffer[i] = 0;
 }
}



⌨️ 快捷键说明

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