首页资源分类嵌入式开发嵌入式系统 > MINI2440 TD35 LCD参数设置

MINI2440 TD35 LCD参数设置

已有 454926个资源

下载专区

上传者其他资源

文档信息举报收藏

标    签: MINI2440TD35LCD参数设置

分    享:

文档简介

MINI2440 TD35 LCD参数设置

文档预览

#include<2440addr.h> #include"pic1.h" #define LCD_WIDTH 320 //屏幕的宽 #define LCD_HEIGHT 240 //屏幕的高 #define U32 unsigned int //垂直同步信号的脉宽、后肩和前肩 #define VSPW ((2-1) &0x3f) #define VBPD ((6-1)&0xff) #define VFPD ((5-1)&0xff) //水平同步信号的脉宽、后肩和前肩 #define HSPW ((1-1)&0xff) #define HBPD ((11-1)&0x7f) #define HFPD ((2-1)&0xff) //显示尺寸 #define LINEVAL (LCD_HEIGHT-1) #define HOZVAL (LCD_WIDTH-1) #define M5D(n) ((n) & 0x1fffff) //for LCDCON1 #define CLKVAL_TFT 4 //设置时钟信号 #define MVAL_USED 0 // #define PNRMODE_TFT 3 //TFT型LCD #define BPPMODE_TFT 12 //12位TFT型LCD extern const unsigned char pic[] ; //for LCDCON5 #define BPP24BL 0 //32位数据表示24位颜色值时,低位数据有效,高8位无效 #define INVVCLK 0 //像素值在VCLK下降沿有效 #define INVVLINE 1 //翻转HSYNC信号 #define INVVFRAME 1 //翻转VSYNC信号 #define INVVD 0 //正常VD信号极性 #define INVVDEN 0 //正常VDEN信号极性 #define PWREN 0 //使能PWREN信号 #define BSWP 0 //颜色数据字节不交换 #define HWSWP 1 //颜色数据半字不交换 //定义显示缓存区 volatile U32 LCD_BUFFER[LCD_HEIGHT][LCD_WIDTH]; //绘制屏幕背景颜色,颜色为c void Brush_Background( U32 c) { int x,y ; for( y = 0 ; y < LCD_HEIGHT ; y++ ) { for( x = 0 ; x < LCD_WIDTH ; x++ ) { LCD_BUFFER[y][x] = c ; } } } void LCD_init(void) { ChangeMPllValue(92,4,1); rCLKDIVN=3; rGPCUP = 0xffffffff; rGPCCON=0xaaaa02a8; rGPDUP = 0xffffffff; rGPDCON=0xaaaaaaaa; rGPGCON &= ~(3<<2*4); rGPGCON |= (1<<4*2); rGPGDAT &= ~(1<<4); rLCDCON1=(CLKVAL_TFT<<8)|(PNRMODE_TFT<<5)|(BPPMODE_TFT<<1)|0; rLCDCON2=(0<<24)|(319<<14)|(0<<6)|(9<<0); rLCDCON3=(100<<19)|(239<<8)|(0<<0); rLCDCON4=(13<<8) | (4<<0); rLCDCON5 = (1<<11) | (1<<10) | (1<<8) | (1<<9) | (PWREN<<3) | (HWSWP<<0); rLCDSADDR1=(((U32)LCD_BUFFER>>22)<<21)| M5D((U32)LCD_BUFFER>>1); rLCDSADDR2=M5D( ((U32)LCD_BUFFER+(LCD_WIDTH*LCD_HEIGHT*2))>>1 ); rLCDSADDR3=320; rLCDINTMSK |= 3; rTCONSEL &= (~7); rTPAL = 0x0; rTCONSEL &= ~((1<<4) | 1); rGPGUP=rGPGUP&(~(1<<4))|(1<<4); //GPG4上拉电阻无效 rGPGCON=rGPGCON&(~(3<<8))|(3<<8); //设置GPG4为LCD_PWREN rGPGDAT = rGPGDAT | (1<<4) ; //GPG4置1 rLCDCON5=rLCDCON5&(~(1<<3))|(1<<3); //有效PWREN信号 rLCDCON5=rLCDCON5&(~(1<<5))|(0<<5); //PWREN信号极性不翻转 rLCDCON1|=1; //LCD开启 } void paint_bmp(const unsigned char bmp[]) { int x,y; unsigned short c; int p=0; for(y=0;y<240;y++) { for(x=0;x<320;x++) { c=(bmp[p+1] | (bmp[p]<<8)); if((x<320)&&(y<240)) LCD_BUFFER[y][x]=c; p=p+2; } } } int main(void) { MMU_Init(); //配置LCD相关引脚 ChangeMPllValue(92,4,1); rCLKDIVN=3; LCD_init( ); while(1) { paint_bmp(pic1); } return 0; }

Top_arrow
回到顶部
EEWORLD下载中心所有资源均来自网友分享,如有侵权,请发送举报邮件到客服邮箱bbs_service@eeworld.com.cn 或通过站内短信息或QQ:273568022联系管理员 高进,我们会尽快处理。