⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 用LPC2200控制TFT
💻 C
字号:
/****************************************Copyright (c)**************************************************
**                               Guangzou ZLG-MCU Development Co.,LTD.
**                                      graduate school
**                                 http://www.zlgmcu.com
**
**--------------File Info-------------------------------------------------------------------------------
** File name:			main.c
** Last modified Date:  2004-09-16
** Last Version:		1.0
** Descriptions:		The main() function example template
**
**------------------------------------------------------------------------------------------------------
** Created by:			Chenmingji
** Created date:		2004-09-16
** Version:				1.0
** Descriptions:		The original version
**
**------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Version:        
** Descriptions:
**
********************************************************************************************************/
#include "config.h"
extern void  DelaymS(uint32);
extern void  TftInit(void); 
//extern void  TFT_UpdateRects(int,int,int,int,uint16 *);
extern void  TftSetWindow(uint16,uint16,uint16,uint16);
extern void  TftSendDat(uint16);
extern void  TFT_FillSCR(uint16);
extern void  TftSetWrite(uint16,uint16);
extern uint8 gImage_SSL23899[];
extern uint8 gImage_SSL24011[];
extern uint8 gImage_SSL24010[];
extern uint8 gImage_navy[];
extern uint8 gImage_flower[];

/*******************************************************
* 名称: DispRGB
* 功能: 显示RGB红色。每种纯色,各占80行。
* 入口参数: 无
* 出口参数: 无
*******************************************************/
void  DispRGB(void)
{
	uint32  x,y;

	TftSetWindow(0,0, 239,319);
	TftSetWrite(0, 0);

	// 填充红色
	for(y=0; y<80; y++)
	{
		for(x=0; x<240; x++)
		{
			TftSendDat(0xF800);
		}
	}

	// 填充绿色
	for(y=0; y<80; y++)
	{
		for(x=0; x<240; x++)
		{
			TftSendDat(0x07E0);
		}
	}

	// 填充蓝色
	for(y=0; y<80; y++)
	{
		for(x=0; x<240; x++)
		{
			TftSendDat(0x001F);
		}
	}

	// 填充白色
	for(y=0; y<80; y++)
	{
		for(x=0; x<240; x++)
		{
			TftSendDat(0xFFFF);
		}
	}

	DelaymS(1*100);			// 延时5S
}


/*******************************************************
* 名称: DispPic
* 功能: 显示图形演示。
* 入口参数: 无
* 出口参数: 无
*******************************************************/
void  DispPic(uint8 *IMAGE)
{
	uint16  x, y;
	uint32  no;  
	uint16  dat;	
	// 第1幅图
	TftSetWindow(0,0, 239, 319);
	TftSetWrite(0,0);
	no = 0;
	for(y=0; y<320; y++)
	{
		for(x=0; x<240; x++)
		{
			dat =*(IMAGE+no+1)<<8 |*(IMAGE+no);
			TftSendDat(dat);
			no++;
			no++;
		}
	}
	DelaymS(1*100);
}
    int main (void)
{
    //uint32 i;
    TftInit();      //液晶模块初始化
    DelaymS(5);
    DispRGB( );
    TFT_FillSCR(0xF800);//用红色清屏  
    TFT_FillSCR(0xFFFF);//用白色清屏
    while(1)
    {   
         DispPic(gImage_navy);
         DelaymS(200);
         DispPic(gImage_SSL24011);
         DelaymS(200);
         DispPic(gImage_flower);
         DelaymS(200);
         //DispPic(gImage_SSL24010);
         //DelaymS(200);
    }
    return(0);
}
/*********************************************************************************************************
**                            End Of File
********************************************************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -