S3C6410 驱动3.5寸TFT LCD( ILI9481 + 触摸屏 )源码,分辨率:480x320; 262K色模式
ILI9481初始化代码:void ili9481_init(void)
{
write_cmd(0x11);
delay_ms(50);
write_cmd(0x13);
write_cmd(0xD0);
write_dat(0x07);
write_dat(0x40);
write_dat(0x11);
write_cmd(0xD1);
write_dat(0x00);
write_dat(0x18);
write_dat(0x1D);
write_cmd(0xD2);
write_dat(0x01);
write_dat(0x11);
write_cmd(0xC0);
write_dat(0x00);
write_dat(0x3B);
write_dat(0x00);
write_dat(0x02);
write_dat(0x11);
write_cmd(0xC1);
write_dat(0x10);
write_dat(0x0B);
write_dat(0x88);
write_cmd(0xC3);
write_dat((1<<4)|0);
write_dat(0x20);
write_dat(0x08);
write_cmd(0xC5);
write_dat(0x01);
write_cmd(0xC6);
write_dat((1<<4)|(1<<3)|(1<<1)|(1<<0));
write_cmd(0xC8);
write_dat(0x00);
write_dat(0x30);
write_dat(0x36);
write_dat(0x45);
write_dat(0x04);
write_dat(0x16);
write_dat(0x37);
write_dat(0x75);
write_dat(0x77);
write_dat(0x54);
write_dat(0x0F);
write_dat(0x00);
write_cmd(0xB4);
write_dat(0x11); //DPI
delay_ms(50);
write_cmd(0x36);
write_dat((0<<7)|(0<<6)|(1<<5)|(1<<3)|(0<<2)|(0<<1)|(0<<0));
// write_dat(0x002b);
write_cmd(0x3A); //262K
write_dat(0x66);
write_cmd(0x2A);
write_dat(0x00);
write_dat(0x00);
write_dat(LCD_XSIZE>>8);
write_dat(LCD_XSIZE);
write_cmd(0x2B);
write_dat(0x00);
write_dat(0x00);
write_dat(LCD_YSIZE>>8);
write_dat(LCD_YSIZE);
delay_ms(50);
write_cmd(0x29);
write_cmd(0x2C);
} S3C6410 LCD初始化代码:
static int lcd_init(void)
{
#if 1
// s3c2450 AT070TN 7.0" (800x480)
/*
#define VBPD (23)
#define VFPD (23)
#define VSPW (23)
#define HBPD (46)
#define HFPD (46)
#define HSPW (46)
*/
#define VBPD (20)
#define VFPD (20)
#define VSPW (20)
#define HBPD (40)
#define HFPD (40)
#define HSPW (40)
#define FRAME_RATE 30
#define LCD_XSIZE_TFT (LCD_XSIZE)
#define LCD_YSIZE_TFT (LCD_YSIZE)
#define LCD_SCR_XSIZE (LCD_XSIZE) // virtual screen
#define LCD_SCR_YSIZE (LCD_YSIZE)
#define LCD_SCR_XSIZE_TFT (LCD_XSIZE) // virtual screen
#define LCD_SCR_YSIZE_TFT (LCD_YSIZE)
//* VIDCON0
#define VIDOUT (0)
#define L1_DATA16 (4)
#define L0_DATA16 (4)
#define PNRMODE (0)
#define CLKVALUP (1)
#define CLKVAL_F (6)
#define CLKDIR (1)
#define CLKSEL_F (0)
//* VIDCON1
#define VCLK_INVERTED (0)
#define HSYNC_INVERTED (0)
#define VSYNC_INVERTED (0)
#define VDEN_INVERTED (0)
//* WINCON1to4
#if(LCD_BPP==16)
#define BITSWP (0) //shift on basis of half-word swap
#define BYTSWP (0) //shift on basis of half-word swap
#define HAWSWP (1) //shift on basis of half-word swap
#endif
#if(LCD_BPP==24)
#define BITSWP (0) //shift on basis of half-word swap
#define BYTSWP (0) //shift on basis of half-word swap
#define HAWSWP (0) //shift on basis of half-word swap
#endif
#define WINCONx_4WORD_BURST (2)
#define WINCONx_8WORD_BURST (1)
#define WINCONx_16WORD_BURST (0)
#define WINCONx_PLANE_BLENDING (0)
#define WINCONx_PIXEL_BLENDING (1)
#define WINCONx_1BPP_PALLET (0)
#define WINCONx_2BPP_PALLET (1)
#define WINCONx_4BPP_PALLET (2)
#define WINCONx_8BPP_PALLET (3)
#define WINCONx_8BPP_NO_PALLET (4)
#define WINCONx_16BPP_565 (5)
#define WINCONx_16BPP_A555 (6)
#define WINCONx_16BPP_1555 (7)
#define WINCONx_18BPP_666 (8)
#define WINCONx_18BPP_A665 (9)
#define WINCONx_19BPP_A666 (10)
#define WINCONx_24BPP_888 (11)
#define WINCONx_24BPP_A887 (12)
#define WINCONx_25BPP_A888 (13)
#define WINCONx_ALPHA_MODE_0 (0)
#define WINCONx_ALPHA_MODE_1 (1)
//#define LCD_HOZVAL_TFT (LCD_YSIZE_TFT-1)
//#define LCD_LINEVAL_TFT (LCD_XSIZE_TFT-1)
int x,y,m,n;
U8 pagewidth_in_byte=0,offsize_in_byte=0;
U8 clkval=0;
U16 hsync_cnt,vclk_cnt;
U16 lcd_horizon_value,lcd_line_value;
U8 lcd_vbpd,lcd_vfpd,lcd_vspw,lcd_hbpd,lcd_hfpd,lcd_hspw;
U8 lcd_frame_rate;
int i;
//// LCD Port
rGPICON = 0xAAAAAAAA;
rGPIPUD = 0xAAAAAAAA;
rGPJCON = 0xAAAAAAAA;
rGPJPUD = 0xAAAAAAAA;
rMIFPCON &=~(1<<3);
rSPCON &=~(3<<0);
rSPCON |=(1<<0);
lcd_horizon_value = LCD_XSIZE;
lcd_line_value = LCD_YSIZE;
lcd_vbpd = VBPD;
lcd_vfpd = VFPD;
lcd_vspw = VSPW;
lcd_hbpd = HBPD;
lcd_hfpd = HFPD;
lcd_hspw = HSPW;
lcd_frame_rate = FRAME_RATE;
pagewidth_in_byte = lcd_horizon_value/8*16;
offsize_in_byte = 0;
hsync_cnt = (lcd_vbpd+lcd_vfpd+lcd_vspw+lcd_line_value);
vclk_cnt = (lcd_hbpd+lcd_hfpd+lcd_hspw+lcd_horizon_value);
//clkval = (U8)(((float)CPU_GetHclkHZ()/(float)(hsync_cnt*vclk_cnt*lcd_frame_rate*2))+0.5)-1;
//clkval = 7;
clkval = 8;
rVIDCON0 &= ~(3<<0); // ENVID Off using Per Frame method
rWINCON0 &= ~(1<<0);
rVIDCON0 = (VIDOUT<<26)|(L1_DATA16<<23)|(L0_DATA16<<20)|(PNRMODE<<17)|(CLKVALUP<<16)|(clkval<<6)|(CLKDIR<<4)|(CLKSEL_F<<2)|(0<<0);
rVIDCON1 = (VCLK_INVERTED<<7)|(HSYNC_INVERTED<<6)|(VSYNC_INVERTED<<5)|(VDEN_INVERTED<<4);
rVIDTCON0 = ((lcd_vbpd-1)<<16)|((lcd_vfpd-1)<<8)|(lcd_vspw-1);
rVIDTCON1 = ((lcd_hbpd-1)<<16)|((lcd_hfpd-1)<<8)|(lcd_hspw-1);
rVIDTCON2 = ((lcd_line_value-1)<<11)|(lcd_horizon_value-1);
#if(LCD_BPP==16)
rWINCON0 = (BITSWP<<18)|(BYTSWP<<17)|(HAWSWP<<16)|(WINCONx_8WORD_BURST<<9)|(WINCONx_16BPP_565<<2); // 16word burst, 16bpp,
#endif
#if(LCD_BPP==24)
rWINCON0 = (BITSWP<<18)|(BYTSWP<<17)|(HAWSWP<<16)|(WINCONx_8WORD_BURST<<9)|(WINCONx_24BPP_888<<2); // 16word burst, 24bpp,
#endif
rVIDOSD0A = (0<<11)|(0);
rVIDOSD0B = (lcd_horizon_value-1)<<11|(lcd_line_value-1);
rVIDW00ADD0B0 = (U32)LCD_Buffer;
rVIDW00ADD1B0 = (U32)LCD_Buffer + LCD_BUF_SIZE;
rVIDW00ADD2 = (offsize_in_byte<<13)|(LCD_XSIZE*sizeof(LCD_COLOR));
//rDITHMODE = (1<<5)|(1<<3)|(1<<1)|(1<<0);
//rDITHMODE = 0;
rVIDCON0 |= (3<<0);
rWINCON0 |= (1<<0);
//? rINTSUBMSK |= (0xf << IRQ_SUB_LCD1); // MASK all LCD Sub Interrupt
DebugPrintf("LCDInit End(%dx%d,%dbpp)\n",LCD_XSIZE,LCD_YSIZE,LCD_BPP);
#endif
} ILI9481数据手册:
点击此处下载 ourdev_622041ED560S.pdf(文件大小:1.61M) (原文件名:ILI9481DS_V0.26.pdf) 3.5寸TFT LCD资料:
点击此处下载 ourdev_622042GR3VK5.pdf(文件大小:770K) (原文件名:TFT1N5290-Ev1.0.pdf) 显示效果:
http://cache.amobbs.com/bbs_upload782111/files_37/ourdev_622047HVLDT8.JPG
(原文件名:DSC_2223.JPG)
http://cache.amobbs.com/bbs_upload782111/files_37/ourdev_622048V4GER3.JPG
(原文件名:DSC_2238.JPG)
http://cache.amobbs.com/bbs_upload782111/files_37/ourdev_622049UFJBBX.JPG
(原文件名:DSC_2254.JPG)
http://cache.amobbs.com/bbs_upload782111/files_37/ourdev_622050GDAOXM.JPG
(原文件名:DSC_2255.JPG)
http://cache.amobbs.com/bbs_upload782111/files_37/ourdev_622051U12FHX.JPG
(原文件名:DSC_2259.JPG)
http://cache.amobbs.com/bbs_upload782111/files_37/ourdev_622052EG1MHX.JPG
(原文件名:DSC_2260.JPG)
http://cache.amobbs.com/bbs_upload782111/files_37/ourdev_622053BI8G36.JPG
(原文件名:DSC_2262.JPG)
http://cache.amobbs.com/bbs_upload782111/files_37/ourdev_622054JBN43L.JPG
(原文件名:DSC_2263.JPG)
http://cache.amobbs.com/bbs_upload782111/files_37/ourdev_622055KO9C75.JPG
(原文件名:DSC_2265.JPG) http://cache.amobbs.com/bbs_upload782111/files_37/ourdev_622056QSGHZR.JPG
(原文件名:DSC_2266.JPG)
http://cache.amobbs.com/bbs_upload782111/files_37/ourdev_622057N4C24Y.JPG
(原文件名:DSC_2268.JPG)
http://cache.amobbs.com/bbs_upload782111/files_37/ourdev_622058HBY7EM.JPG
(原文件名:DSC_2270.JPG)
http://cache.amobbs.com/bbs_upload782111/files_37/ourdev_622059FYH07S.JPG
(原文件名:DSC_2271.JPG)
http://cache.amobbs.com/bbs_upload782111/files_37/ourdev_622060WVP34E.JPG
(原文件名:DSC_2272.JPG)
http://cache.amobbs.com/bbs_upload782111/files_37/ourdev_622061PDBY2Z.JPG
(原文件名:DSC_2274.JPG)
http://cache.amobbs.com/bbs_upload782111/files_37/ourdev_622062M1WP4K.JPG
(原文件名:DSC_2275.JPG)
http://cache.amobbs.com/bbs_upload782111/files_37/ourdev_622063LXZJG6.JPG
(原文件名:DSC_2282.JPG)
http://cache.amobbs.com/bbs_upload782111/files_37/ourdev_622064G6T7Y0.JPG
(原文件名:DSC_2283.JPG) http://cache.amobbs.com/bbs_upload782111/files_37/ourdev_622103J05Z18.jpg
(原文件名:2352.jpg) 好东西,mark 在21IC也看到了
请问楼主
触摸屏也是原配的?
整个TFT模块+触摸屏好多钱 触摸屏是原配的.
回复【8楼】wu0232
在***也看到了
请问楼主
触摸屏也是原配的?
整个tft模块+触摸屏好多钱
-----------------------------------------------------------------------
触摸屏是原配的. 楼主,能公布一下接线图吗,十分感谢 还有,屏是哪家的,很漂亮 回复【11楼】xiaojian
还有,屏是哪家的,很漂亮
-----------------------------------------------------------------------
国内很有名的一厂家,不是山寨屏 给个淘宝链接好吗? 刘的界面做的越来越漂亮了ps 有张图片中那位mm是? 回复【14楼】chinaye1
刘的界面做的越来越漂亮了ps 有张图片中那位mm是?
-----------------------------------------------------------------------
公司里的MM~~~~~ 回复【13楼】flkflk
给个链接好吗?
-----------------------------------------------------------------------
没有淘宝,直接丛代理商那买的 mark 楼主能把ILI9481的驱动源码给传上来吗? 同意楼上的看法! 此硬件配置,也想搞一个。由于手头项目忙,一直没有出手。 回复【18楼】ndt2000
楼主能把ili9481的驱动源码给传上来吗?
-----------------------------------------------------------------------
回复【19楼】qt_girl 陆通科技
同意楼上的看法!
-----------------------------------------------------------------------
ili9481驱动在第1楼~~~~~~~~~~~ mark mark mark 我用你的程序编译之后,下载到我的卡上,结果LCD的CLK,VSYNC,HSYNC等无信号,请教是什么原因? 回复【27楼】qq302011
我用你的程序编译之后,下载到我的卡上,结果lcd的clk,vsync,hsync等无信号,请教是什么原因?
-----------------------------------------------------------------------
用这个图形操作系统试试:
http://www.ourdev.cn/bbs/bbs_content.jsp?bbs_sn=4823445&bbs_page_no=1&search_mode=4&search_text=liuweiele&bbs_id=9999 想请问一下前辈,9481的打点函数怎么写?我在pdf中就是找不到打点的命令 回复【29楼】xsx728
想请问一下前辈,9481的打点函数怎么写?我在pdf中就是找不到打点的命令
-----------------------------------------------------------------------
我使用的是DPI接口方式,显存直接映射在本地RAM中. MARK 楼主你好,可以找到TFT8K2346这个屏的资料吗? mark 能多点资源就好了,白菜漂过! 楼主,有友善之臂s3c6410 4.3寸液晶的驱动吗?能上传一份吗?谢谢啦 非常不错,mark:S3C6410 驱动3.5寸TFT LCD( ILI9481) 硬件怎么接的?能否公开 本帖最后由 LCRPN 于 2012-5-6 12:08 编辑
ili9481能不能像9320那样设置光标,还有自增方向;我看手册发现好像只能设置显示的矩形区域,用0x002A和0x002B命令。
但是现在写点的函数仅在设置光标时就需要写10个数据,以下是STM32的FSCM驱动设置光标的例子,其实就是设置光标到右下角之间的区域为操作区域。
*(__IO uint16_t *) (Bank1_LCD_ili9481_R) = (0x002A);
*(__IO uint16_t *) (Bank1_LCD_ili9481_D) = (Xpos>>8);
*(__IO uint16_t *) (Bank1_LCD_ili9481_D) = (0x00FF&Xpos);
*(__IO uint16_t *) (Bank1_LCD_ili9481_D) = (0x0001);
*(__IO uint16_t *) (Bank1_LCD_ili9481_D) = (0x003F);
*(__IO uint16_t *) (Bank1_LCD_ili9481_R) = (0x002B);
*(__IO uint16_t *) (Bank1_LCD_ili9481_D) = (Ypos>>8);
*(__IO uint16_t *) (Bank1_LCD_ili9481_D) = (0x00FF&Ypos);
*(__IO uint16_t *) (Bank1_LCD_ili9481_D) = (0x0001);
*(__IO uint16_t *) (Bank1_LCD_ili9481_D) = (0x00df);
这太慢了,9320的,只需要写四次:
*(__IO uint16_t *) (Bank1_LCD_ili9325_R) = R32;
*(__IO uint16_t *) (Bank1_LCD_ili9325_D) = Xpos;
*(__IO uint16_t *) (Bank1_LCD_ili9325_R) = R33;
*(__IO uint16_t *) (Bank1_LCD_ili9325_D) = Ypos;
在有没有办法加快写点函数? 牛人
既然公开代码,为何不上传一份源码文件呢? 也在学习中~~ 楼主好人,谢谢。 留着,备用,谢谢
来自:amoBBS 阿莫电子论坛 Android客户端 {:handshake:}{:handshake:}{:handshake:} Mark,需要时回来再学
页:
[1]