mini2440-128M开发板裸奔系列10——LCD测试程序.doc_第1页
mini2440-128M开发板裸奔系列10——LCD测试程序.doc_第2页
mini2440-128M开发板裸奔系列10——LCD测试程序.doc_第3页
mini2440-128M开发板裸奔系列10——LCD测试程序.doc_第4页
mini2440-128M开发板裸奔系列10——LCD测试程序.doc_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

mini2440-128M开发板裸奔系列10LCD测试程序2010-04-13 11:01#include def.h#include option.h#include 2440addr.h#include 2440lib.h#include 2440slib.hextern const unsigned char sunflower_240x320;extern const unsigned char girl;extern const unsigned char Zhaidi;extern const unsigned char hua;/extern const unsigned char sunflower_800x480;/extern const unsigned char sunflower_1024x768;/extern const unsigned char sunflower_640x480;#define LCD_XSIZE LCD_WIDTH#define LCD_YSIZE LCD_HEIGHT#define SCR_XSIZE LCD_WIDTH#define SCR_YSIZE LCD_HEIGHTvolatile static unsigned short LCD_BUFFERSCR_YSIZESCR_XSIZE;/*640480 TFT LCD数据和控制端口初始化*/static void Lcd_Port_Init( void ) rGPCUP=0xffffffff; / 端口C上拉控制 P141 rGPCCON=0xaaaa02a8; /配置端口C的引脚功能 P141Initialize VD7:0,VM,VFRAME,VLINE,VCLK rGPDUP=0xffffffff; / Disable Pull-up register rGPDCON=0xaaaaaaaa; /Initialize VD15:8 P142/*640480 TFT LCD功能模块初始化*/static void LCD_Init(void)#define M5D(n) (n)&0x1fffff)#define LCD_ADDR (U32)LCD_BUFFER)rLCDCON1 = (LCD_PIXCLOCK 8) | (3 5) | (12 1);/p200 CLKVAL=0x14 PNRMODE6:5为11 rLCDCON2 = (LCD_UPPER_MARGIN 24) | (LCD_HEIGHT - 1) 14) | (LCD_LOWER_MARGIN 6) | (LCD_VSYNC_LEN 0); /P201 31:24VBPD:场同步信号后沿 23:14LINEVAL:决定LCD屏的垂直方向的大小 13:6VFPD场同步信号前沿 5:0VSPW:场同步脉冲宽度 rLCDCON3 = (LCD_RIGHT_MARGIN 19) | (LCD_WIDTH - 1) 8) | (LCD_LEFT_MARGIN 0); /P201 25:19HBPD WDLY 18:8决定LCD水平显示尺寸 【7:0】 rLCDCON4 = (13 8) | (LCD_HSYNC_LEN 0); /15:8:MVAL 该位只对STN屏有效,当MMODE置位为1时,决定VM的变换频率 7:0行同步脉冲宽度#if !defined(LCD_CON5)# define LCD_CON5 (111) | (1 9) | (1 8) | (1 3) | (1 22) 1) 1); /p203 rLCDSADDR3 = LCD_WIDTH; /p203 rLCDINTMSK |= 3; /p205-206 屏蔽LCD帧同步中断 屏蔽LCD FIFO中断rTCONSEL &= (7); rTPAL = 0x0; rTCONSEL &= (14) | 1); /*LCD视频和控制信号输出或者停止,1开启视频输出*/static void Lcd_EnvidOnOff(int onoff) if(onoff=1)rLCDCON1|=1; / ENVID=ON elserLCDCON1 =rLCDCON1 & 0x3fffe; / ENVID Off/*320240 8Bpp TFT LCD 电源控制引脚使能*/static void Lcd_PowerEnable(int invpwren,int pwren) /GPG4 is setted as LCD_PWREN rGPGUP = rGPGUP|(14); / Pull-up disable rGPGCON = rGPGCON|(38); /GPG4=LCD_PWREN /Enable LCD POWER ENABLE Function rLCDCON5 = rLCDCON5&(13)|(pwren3); / PWREN rLCDCON5 = rLCDCON5&(15)|(invpwren5); / INVPWREN/*640480 TFT LCD单个象素的显示数据输出*/static void PutPixel(U32 x,U32 y,U16 c) if(xSCR_XSIZE & ySCR_YSIZE) LCD_BUFFER(y)(x) = c;/*640480 TFT LCD全屏填充特定颜色单元或清屏*/static void Lcd_ClearScr( U32 c)unsigned int x,y ; for( y = 0 ; y SCR_YSIZE ; y+ ) for( x = 0 ; x SCR_XSIZE ; x+ ) LCD_BUFFERyx = c ; /*LCD屏幕显示垂直翻转/ LCD display is flipped vertically/ But, think the algorithm by mathematics point./ 3I2/ 4 I 1/ -+- =0) if(dy = 0) / dy=0 if(dx=dy) / 1/8 octant e=dy-dx/2; while(x10)y1+=1;e-=dx; x1+=1; e+=dy; else / 2/8 octant e=dx-dy/2; while(y10)x1+=1;e-=dy; y1+=1; e+=dx; else / dy=dy) / 8/8 octant e=dy-dx/2; while(x10)y1-=1;e-=dx; x1+=1; e+=dy; else / 7/8 octant e=dx-dy/2; while(y1=y2) PutPixel(x1,y1,color); if(e0)x1+=1;e-=dy; y1-=1; e+=dx; else /dx= 0) / dy=0 if(dx=dy) / 4/8 octant e=dy-dx/2; while(x1=x2) PutPixel(x1,y1,color); if(e0)y1+=1;e-=dx; x1-=1; e+=dy; else / 3/8 octant e=dx-dy/2; while(y10)x1-=1;e-=dy; y1+=1; e+=dx; else / dy=dy) / 5/8 octant e=dy-dx/2; while(x1=x2) PutPixel(x1,y1,color); if(e0)y1-=1;e-=dx; x1-=1; e+=dy; else / 6/8 octant e=dx-dy/2; while(y1=y2) PutPixel(x1,y1,color); if(e0)x1-=1;e-=dy; y1-=1; e+=dx; /*在LCD屏幕上用颜色填充一个矩形*/static void Glib_FilledRectangle(int x1,int y1,int x2,int y2, U16 color) int i; for(i=y1;i=y2;i+)Glib_Line(x1,i,x2,i,color);/*在LCD屏幕上指定坐标点画一个指定大小的图片*/static void Paint_Bmp(int x0,int y0,int h,int l,const unsigned char *bmp)int x,y;U32 c;int p = 0; for( y = 0 ; y l ; y+ ) for( x = 0 ; x h ; x+ ) c = bmpp+1 | (bmpp8) ; if ( ( (x0+x) SCR_XSIZE) & ( (y0+y) SCR_YSIZE) ) LCD_BUFFERy0+yx0+x = c ; p = p + 2 ; /*/void TFT_LCD_Init(void) LCD_Init();LcdBkLtSet( 70 ) ;Lcd_PowerEnable(0, 1); Lcd_EnvidOnOff(1); /turn on vedio Lcd_ClearScr( (0x0011) | (0x005) | (0x00) ); #if defined(LCD_N35) | defined(LCD_T35)Paint_Bmp(0, 0, 240, 320, hua);#endif /*/void TFT_LCD_Test(void)#if defined(LCD_N35) | defined(LCD_T35)Uart_Printf(nTest TFT LCD 240x320!n);#endif Lcd_Port_Init(); LCD_Init(); Lcd_EnvidOnOff(1); /turn on vedioLcd_ClearScr( (0x07e011) | (0x07e05) | (0x07e0) ) ; /clear screenUart_Printf( nLCD clear screen is finished! press any key to continue!n ); Uart_Getch() ; /wait uart inputLcd_ClearScr( (0x1f11) | (0x3f5) | (0x1f) ) ; /clear screenUart_Printf( LCD clear screen is finished! press any key to continue!n ); Uart_Getch() ; /wait uart input/Lcd_ClearScr(0xffff); /fill all screen with some color#define LCD_BLANK 30#define C_UP ( LCD_XSIZE - LCD_BLANK*2 )#define C_RIGHT ( LCD_XSIZE - LCD_BLANK*2 )#define V_BLACK ( ( LCD_YSIZE - LCD_BLANK*4 ) / 6 )Glib_FilledRectangle( LCD_BLANK, LCD_BLANK, ( LCD_XSIZE - LCD_BLANK ), ( LCD_YSIZE - LCD_BLANK ),0x0000); /fill a Rectangle with some colorGlib_FilledRectangle( (LCD_BLANK*2), (LCD_BLANK*2 + V_BLACK*0), (C_RIGHT), (LCD_BLANK*2 + V_BLACK*1),0x001f); /fill a Rectangle with some colorGlib_FilledRectangle( (LCD_BLANK*2), (LCD_BLANK*2 + V_BLACK*1), (C_RIGHT), (LCD_BLANK*2 + V_BLACK*2),0x07e0); /fill a Rectangle with some colorGlib_FilledRectangle( (LCD_BLANK*2), (LCD_BLANK*2 + V_BLACK*2), (C_RIGHT), (LCD_BLANK*2 + V_BLACK*3),0xf800); /fill a Rectangle with some colorGlib_FilledRectangle( (LCD_BLANK*2), (LCD_BLANK*2 + V_BLACK*3), (C_RIGHT), (LCD_BLANK*2 + V_BLACK*4),0xffe0); /fill a Rectangle with some colorGlib_FilledRectangle( (LCD_BLANK*2), (LCD_BLANK*2 + V_BLACK*4), (C_RIGHT), (LCD_BLANK*2 + V_BLACK*5),0xf81f); /fill a Rectangle with some colorGlib_FilledRectangle( (LCD_BLANK*2), (LCD_BLANK*2 + V_BLACK*5), (C_RI

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论