TFT液晶屏C51控制
/*功能描述:TFT(ILI9325)液晶测试程序 */
/*作者:ClimberWin */
/*编写时间:2010.3.8 */
/*功能:TFT液晶显示图片和打印字符 */
/*STC89C58RD 接外部晶振11.0592 MHZ */
/**************************************************/
#include
#include"ILI9325.H"
main()
{
uchar i;
LCD_INIT(); //TFT初始化
LCD_picture_diplay();
LCD_write_english_string(20,20,"TFT C51 Test
OK",GREEN,BLACK);
LCD_write_english_string(20,40,"ClimberWin
2010.3.8",GREEN,BLACK);
for(i=0;i<10;i++)
{
LCD_caitiao_diplay(100,RED);
LCD_caitiao_diplay(120,GREEN);
LCD_caitiao_diplay(140,BLUE);
LCD_caitiao_diplay(160,YELLOW);
LCD_caitiao_diplay(180,WHITE);
LCD_caitiao_diplay(200,MAGENTA);
LCD_caitiao_diplay(220,CYAN);
LCD_caitiao_diplay(100,CYAN);
LCD_caitiao_diplay(120,RED);
LCD_caitiao_diplay(140,GREEN);
LCD_caitiao_diplay(160,BLUE);
LCD_caitiao_diplay(180,YELLOW);
LCD_caitiao_diplay(200,WHITE);
LCD_caitiao_diplay(220,MAGENTA);
}
while(1);
}
///////////////////////////////////////////////头文件定义//////////////////////////////////////////////////
#ifndef_ILI9325_H_
#define_ILI9325_H_
#include
#include"picture.h"
#include"english_16x8.h"
#define uchar unsigned char
#define uint unsigned int
#define ulong unsigned long
#defineBLACK0x0000 //黑
#defineBLUE0x001F //蓝
#defineRED 0xF800 //红
#defineGREEN 0x07E0 //绿
#define CYAN0x07FF //青
#define MAGENTA 0xF81F //洋红
#define YELLOW0xFFE0 //黄
#define WHITE0xFFFF //白
#define LCD_DA
sbit LCD_RS = P2^0; //数据/命令切换
sbit LCD_RST = P2^7; //复位
sbit LCD_WR = P2^1; //写控制
sbit LCD_RD =P2^2; //读控制
sbit LCD_CS=P2^5;
void delayms(uint count);
void LCD_Write_REG(uint lcd_reg); //8位数据接口发送16位寄存器地址
void LCD_Write_DA
void LCD_Write_REG_DA
void LCD_Add_Set(uint x1,uint y1,uint x2,uint y2);//设置坐标
void LCD_INIT(void);//液晶初始化
void LCD_picture_diplay(void);//显示图片
void LCD_write_english(unsigned char da
void LCD_write_english_string(unsigned int x,unsigned int y,unsigned char *s,unsigned int color,unsigned int xcolor);//英文字符串显示
void Lcd_SetBox(unsigned int xStart,unsigned int yStart,unsigned int xLong,unsigned int yLong);
void LCD_SetCursor(unsigned int Xpos, unsigned int Ypos);
void LCD_Clear(unsigned int Color);
void LCD_caitiao_diplay(uchar x,uint color);//画彩条 20点宽 320点长
void delayms(uint count)
{
unsigned int i,j;
for(i=0;i
}
void LCD_Write_REG( uint lcd_reg) //8位数据接口发送16位寄存器地址
{
LCD_RS=0;
LCD_CS =0;
LCD_DA
LCD_WR=0;
LCD_WR=1;
LCD_DA
LCD_WR=0;
LCD_WR=1;
LCD_CS =1;
}
void LCD_Write_DA
{
LCD_RS=1;
LCD_CS =0;
LCD_DA
LCD_WR=0;
LCD_WR=1;
LCD_DA
LCD_WR=0;
LCD_WR=1;
LCD_CS =1;
}
void LCD_Write_REG_DA
{
LCD_Write_REG(lcd_reg);
LCD_Write_DA
}
void LCD_Add_Set(uint x1,uint y1,uint x2,uint y2)
{
LCD_Write_REG_DA
LCD_Write_REG_DA
LCD_Write_REG_DA
LCD_Write_REG_DA
LCD_Write_REG_DA
LCD_Write_REG_DA
LCD_Write_REG(0x0022);
}
///////////液晶初始化程序////////////////////
void LCD_INIT(void)
{
LCD_RST=1;
delayms(5);
LCD_RST=0;
delayms(10);
LCD_RST=1;
delayms(20);
//************* Start Initial Sequence **********//
LCD_Write_REG(0x00E5); LCD_Write_DA
TFT液晶屏C51控 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)