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

          新聞中心

          EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > ucos II+ucGUI+s3c2410+LCD+觸摸屏整合

          ucos II+ucGUI+s3c2410+LCD+觸摸屏整合

          作者: 時(shí)間:2016-10-08 來(lái)源:網(wǎng)絡(luò) 收藏

          環(huán)境:ads2.2+ARM9 +s3c2410

          本文引用地址:http://www.ex-cimer.com/article/201610/305841.htm

          注意:由于編譯器(ads1.2或2.2)對(duì)全局變量初始化為0的不完全支持,有時(shí)必須手動(dòng)初始化為0,切記!!!

          一、ucos II移植到ARM9 s3c2410

          可從官網(wǎng)下載移植代碼,基本無(wú)需改動(dòng)。

          在os_cpu_a.s中的函數(shù)UCOS_IRQHandler中的bl OSIntEnter和bl C_IRQHandler之間插入如下代碼(見(jiàn)邵貝貝,第2版,第104頁(yè)的說(shuō)明:L3.18(4) ):

          ldr r0, =OSIntNesting

          ldrb r0,[r0]

          cmp r0,#1

          bne XX

          ldr r0,=OSTCBCur

          ldr r1,[r0]

          str sp,[r1] ; store sp in preempted tasks's TCB

          XX

          二、ucGui 390移植到ARM9 s3c2410

          1. Lcd驅(qū)動(dòng):

          1) 畫(huà)點(diǎn)函數(shù):

          對(duì)dm2410實(shí)驗(yàn)板上的lcd,左上為原點(diǎn)(0,0),函數(shù)如下:

          void LCD2410_SetPixel(int xp, int yp, U16 color, int dindex)

          {

          *(pLCDBuffer565 + SCREEN_WIDTH*yp + xp) = color;

          }

          為了達(dá)到更快的顯示速度,別忘了開(kāi)啟Cache!!!

          2)LCD控制器的初始化,對(duì)2410函數(shù)如下:

          int LCD2410_Init(void)

          {

          if(!isLcdInit)

          {

          InitLcdPort();

          InitLcdRegs();

          isLcdInit = 1;

          return 0;

          }

          return 1;

          }

          void InitLcdPort(void)

          {

          // LCD port initialize.

          s2410IOP->GPCUP = 0xFFFFFFFF;

          s2410IOP->GPCCON = 0xAAAAAAAA;

          s2410IOP->GPDUP = 0xFFFFFFFF;

          s2410IOP->GPDCON = 0xAAAAAAAA;

          s2410IOP->GPGCON = ~(3 8); /* Set LCD_PWREN as output */

          s2410IOP->GPGCON |= (1 8);

          s2410IOP->GPGDAT |= (1 4); //* Backlight ON

          }

          void InitLcdRegs(void)

          {

          s2410LCD->LCDCON1 = (CLKVAL_TFT 8) | //* VCLK = HCLK / ((CLKVAL + 1) * 2) -> About 7 Mhz

          (EACH_FRAME 7) | //* 0 : Each Frame

          (3 5) | // TFT LCD Pannel

          (12 1) | //Y: // 16bpp Mode

          (0 0) ; // Disable LCD Output

          s2410LCD->LCDCON2 = (VBPD 24) | //* VBPD : ((32-1)0xff) = 0x1f

          (LINEVAL_TFT 14) | //* LINEVAL_TFT : 480 - 1

          (VFPD 6) | //* VFPD : ((11-1)0xff) = 0xa

          (VSPW 0) ; //* VSPW : ((2-1) 0x3f) = 0x1

          s2410LCD->LCDCON3 = (HBPD 19) | //* HBPD : ((88-1)0x7f)

          (HOZVAL_TFT 8) | //* HOZVAL_TFT : 800 - 1

          (HFPD 0) ; //* HFPD : ((40-1)0xff)

          s2410LCD->LCDCON4 = (MVAL 8) | //* MVAL : 13

          (HSPW 0) ; //* HSPW : ((128-1)0xff)

          s2410LCD->LCDCON5 = (0 12) | // BPP24BL : LSB valid

          (1 11) | // FRM565 MODE : 5:5:5:1 Format

          (0 10) | // INVVCLK : VCLK Falling Edge

          (1 9) | // INVVLINE : Inverted Polarity

          (1 8) | // INVVFRAME : Inverted Polarity

          (0 7) | // INVVD : Normal

          (0 6) | // INVVDEN : Normal

          (0 5) | // INVPWREN : Normal

          (0 4) | // INVENDLINE : Normal

          (1 3) | // PWREN : Disable PWREN

          (0 2) | // ENLEND : Disable LEND signal

          (0 1) | // BSWP : Swap Disable

          (1 0) ; // HWSWP : Swap Enable

          s2410LCD->LCDSADDR1 = ((FRAMEBUF_DMA_BASE >> 22) 21) |

          ((M5D(FRAMEBUF_DMA_BASE >> 1)) 0);

          s2410LCD->LCDSADDR2=M5D( (FRAMEBUF_DMA_BASE+(LCD_XSIZE_TFT*LCD_YSIZE_TFT*2))>>1 );

          s2410LCD->LCDSADDR3=(((LCD_XSIZE_TFT-LCD_XSIZE_TFT)/1)11)|(LCD_XSIZE_TFT/1);

          s2410LCD->LCDINTMSK|=(3); // MASK LCD Sub Interrupt

          s2410LCD->LPCSEL=(~7); // Disable LPC3600

          s2410LCD->TPAL=0; // Disable Temp Palette

          s2410LCD->LCDCON1 |= 1;

          }

          其中,部分變量、常量定義如下:

          #define LCD_XSIZE_TFT (800)

          #define LCD_YSIZE_TFT (480)

          #define HOZVAL_TFT (LCD_XSIZE_TFT-1)

          #define LINEVAL_TFT (LCD_YSIZE_TFT-1)

          #define MVAL (13)

          #define MVAL_USED (1)

          #define EACH_FRAME (0)

          //STN/CSTN timing parameter for LCBHBT161M(NANYA)

          #define WLH (3)

          #define WDLY (3)

          #define LINEBLANK (1 0xff)

          #define VBPD ((32-1)0xff)

          #define VFPD ((11-1)0xff)

          #define VSPW ((2-1) 0x3f)

          #define HBPD ((88-1)0x7f)

          #define HFPD ((40-1)0xff)

          #define HSPW ((128-1)0xff)

          #define CLKVAL_TFT (0)

          #define M5D(n) ((n) 0x1fffff)

          #define SCREEN_WIDTH 800 //800

          #define SCREEN_HEIGHT 480 //480

          #define FRAMEBUF_DMA_BASE (0x35000000)

          U16* pLCDBuffer565=(U16*)FRAMEBUF_DMA_BASE;

          3)填寫(xiě)配置文件LCDConf.h

          #define LCD_XSIZE (800) /* X-resolution of LCD, Logical coor. */

          #define LCD_YSIZE (480) /* Y-resolution of LCD, Logical coor. */

          #define LCD_BITSPERPIXEL (16)

          #define LCD_CONTROLLER 1

          #define LCD_SWAP_RB_0 1

          2.觸摸屏驅(qū)動(dòng):

          觸摸屏驅(qū)動(dòng)計(jì)算出觸摸屏的坐標(biāo)(x,y),對(duì)dm2410實(shí)驗(yàn)板上的觸摸屏,左下為原點(diǎn),但不一定是(0,0)。兩個(gè)函數(shù):


          上一頁(yè) 1 2 3 4 5 下一頁(yè)

          關(guān)鍵詞:

          評(píng)論


          相關(guān)推薦

          技術(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); })();