资源简介
ST7735R的资料和初始化源码,有用到的可以看看
代码片段和文件信息
/****************************
Module Name:LaiBao1.77+ST7735R
2009-04-16
*****************************/
#include
#include
#include
#define nop _nop_()
#define DataPort_H P2
#define DataPort_L P0
#define CtrlPort P1
//define the LCM pixel
#define DisplayCol 160
#define DisplaySeg 128
#define red_i 0x0800
#define green_i 0x0020
#define blue_i 0x0001
//#define usnigned short int blue_i=1;
#define RED_STEP 32
#define GREEN_STEP 64
#define BLUE_STEP 32
#define LCM_WIDTH 128
#define LCM_HEIGH 160
//define LCD control interface
//P0==>74LS245(U9)==>U2(SST39VF040)P0==>74LS245(U6)==>D0~D7
//P2==>74LS245(U7)==>U3(SST39VF040)P2==>74LS245(U10)==>D8~D15
//if P1.6=0U9&U10 select A===>B
//if P1.7=0U6&U7 select A===>B
sbit Gate_U6_U7 = CtrlPort^7;
sbit Gate_U9_U10 = CtrlPort^6;
sbit _CS1 = CtrlPort^4;
sbit _WR = CtrlPort^3;
sbit _RD = CtrlPort^2;
sbit RS = CtrlPort^1;
sbit LCD_nRESET = CtrlPort^0;
//define key interface
//sbit STOP = P1^7;
sbit KeyUP = P2^0;
sbit KeyDown = P2^1;
//LED test define
sbit LED1 = P2^2; // LED=‘1‘ means ON
sbit LED2 = P2^3; // LED=‘1‘ means ON
sbit PA0=P2^4;
sbit PA1=P2^5;
sbit PA2=P2^6;
sbit FlashChip1Select=P2^7; //
unsigned int pageseg;
unsigned int step=0;
unsigned int xdata *ptr;
/*******************************************************/
void delay(unsigned int param)
{
int i;
for(;param>0;param--)
for(i=0;i<960;i++);
}
void delayms(unsigned int param) //DELAY 1 MS
{
int i;
for(;param>0;param--)
for(i=0;i<400;i++);
}
void LCD_Index(unsigned char index)
{
Gate_U9_U10 =0;
_CS1=0;
_RD=1;
RS=0;
//_WR=0;
DataPort_L=index;
_WR=0;
//delayms(0);
_WR=1;
_CS1=1;
Gate_U9_U10 =1;
}
void LCD_DataWrite(unsigned char set_db) //80-8bit
{
Gate_U9_U10 =0;
_CS1=0;
_RD=1;
RS=1;
//_WR=0;
DataPort_L=set_db;
_WR=0; //delayms(0);
_WR=1;
_CS1=1;
Gate_U9_U10 =1;
}
void LCD_Data(unsigned int set_db) //80-8bit
{
LCD_DataWrite(set_db>>8);
LCD_DataWrite(set_db);
}
void LCD_CmdWrite(unsigned char indexunsigned char set_db)
{
LCD_Index(index);
LCD_DataWrite(set_db);
}
void LCD_Reset(void)
{
// Gate_U6_U7 =0;
//Gate_U9_U10 =0;
//delayms(1);
_CS1=1;
LCD_nRESET=1;
LCD_nRESET=0;
delayms(1);
LCD_nRESET=1;
delayms(100);
}
5_init(void) //Laibao1.77+ST7735
{
void LB177_773
LCD_Index(0x11); //SLEEP OUT&BOOST ON
delayms(200);
// delayms(200);
LCD_Index(0xff); //Vcom 4 Level control
LCD_DataWrite(0x40);
LCD_DataWrite(0x01); //或03 调水波纹
LCD_DataWrite(0x1a);
LCD_Index(0xd9); //close IDLE
LCD_DataWrite(0x60);
LCD_Index(0xc7);
LCD_DataW
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 11987 2011-12-30 15:55 ST7735R.c
文件 2124884 2011-12-30 15:55 ST7735R_V1.2_20100714.pdf
----------- --------- ---------- ----- ----
2136871 2
- 上一篇:Comsol软件传热模块介绍
- 下一篇:H3C全系列产品方案选型参考集合
评论
共有 条评论