<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          S3C2440-LCD圖片顯示

          作者: 時(shí)間:2016-12-02 來(lái)源:網(wǎng)絡(luò) 收藏
          折騰了幾日,終于可以將圖片顯示LCD上了,我使用的東華的WXCAT35-TG3#001 TFT LCD。首先使用PHOTOSHOP軟件將圖片改成寬320,高240,注意不要反了。然后用Image2Lcd_32軟件提取出數(shù)組。我選的是24位真彩。所以一個(gè)像素3個(gè)字節(jié),顯示的時(shí)候,通過(guò)位運(yùn)算將3個(gè)字節(jié)合到一起,顯示在一個(gè)像素上。


          Image2Lcd_32的配置方法:
          #include "2440addr.h"
          #include "picture.h"
          //垂直同步信號(hào)的脈寬、后肩和前肩
          #define VSPW 15
          #define VBPD 3
          #define VFPD 5
          //水平同步信號(hào)的脈寬、后肩和前肩
          #define HSPW 8
          #define HBPD 58
          #define HFPD 15
          #define CLKVAL 10
          #define HOZVAL 319
          #define LINEVAL 239
          #define PWREN 1
          #define MMODE 0
          #define PNRMODE 3
          #define BPPMODE 13
          #define INVVCLK 0
          #define INVVD 0
          #define INVVDEN 0
          #define U32 unsigned int
          #define M5D(n) ((n) & 0x1fffff)
          #define PAGEWIDTH 320
          #define OFFSIZE 0
          #define LCD_XSIZE 320
          #define LCD_YSIZE 240
          #define SCR_XSIZE 320
          #define SCR_YSIZE 240
          #define INVVLINE 1
          #define INVVFRAME 1
          #define BPP24BL 0
          #define BSWP 0
          #define HWSWP 0
          volatile U32 LCD_BUFFER[240][320];
          void Init_LCD(){
          rLCDCON1=(CLKVAL<<8)|(MMODE<<7)|(PNRMODE<<5)|(BPPMODE<<1)|0; //設(shè)置CLKVAL,VCLK=HCLK/[(CLKVAL+1)*2],決定VM的觸發(fā)方式,選擇顯示模式和BPP模式,暫時(shí)不要開啟LCD,因?yàn)檫€沒(méi)有設(shè)置好
          rLCDCON2=(VBPD<<24)|(LINEVAL<<14)|(VFPD<<6)|(VSPW); //rLCDCON2,rLCDCON3和rLCDCON4主要設(shè)置時(shí)序
          rLCDCON3=(HBPD<<19)|(HOZVAL<<8)|(HFPD);
          rLCDCON4=(HSPW);
          rLCDCON5 = (BPP24BL<<12) | (INVVCLK<<10) | (INVVLINE<<9) | (INVVFRAME<<8) | (0<<7) | (INVVDEN<<6) | (PWREN<<3) |(BSWP<<1) | (HWSWP); //INVVLINE和INVVFRAME需要進(jìn)行翻轉(zhuǎn),因?yàn)镃PU發(fā)出的是正脈沖,LCD使用的是負(fù)脈沖,所以要改變極性,PWREN使能電源信號(hào)
          rLCDSADDR1=(((U32)LCD_BUFFER>>22)<<21)|M5D((U32)LCD_BUFFER>>1);
          rLCDSADDR2=M5D(((U32)LCD_BUFFER+(SCR_XSIZE*SCR_YSIZE*4))>>1 );
          rLCDSADDR3=PAGEWIDTH*32/16;
          rLCDINTMSK|=(3);
          rTCONSEL = 0;
          rGPCUP = 0x0;
          rGPDCON = 0xaaaaaaaa;
          rGPCCON = 0xaaaa02a9;
          rGPDUP = 0x0;
          rGPGUP=rGPGUP&("(1<<4))|(1<<4);
          rGPGCON=rGPGCON&("(3<<8))|(3<<8);
          rLCDCON1 |= 1; //使能數(shù)據(jù)輸出和LCD控制信號(hào)
          }
          void Paint(unsigned char ch[]){
          int y, x, t = 0;
          for(y = 0; y < LCD_YSIZE; y++)
          for(x = 0; x < LCD_XSIZE; x++){
          LCD_BUFFER[y][x] = (ch[t]<<16)|(ch[t+1]<<8)|(ch[t+2]); //因?yàn)槭?4位真彩,所將3個(gè)字節(jié)賦值到一個(gè)像素點(diǎn)上
          t = t + 3;
          }
          }
          void Paint_background(U32 c){
          unsigned int i, j;
          for(j = 0; j < LCD_YSIZE; j++)
          for(i = 0; i < LCD_XSIZE; i++)
          LCD_BUFFER[j][ i] = c;
          }
          int LcdMain(){
          Init_LCD();
          Paint_background(0xFFFFFF);
          Paint(picture); //picture是從圖片中提取出來(lái)的數(shù)組
          while(1);
          }


          關(guān)鍵詞: S3C2440LCD圖片顯

          評(píng)論


          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();