📄 lcd320.c
字号:
#include <stdarg.h>
#include <stdio.h>
#include "..\inc\def.h"
#include "..\startup\44b.h"
#include "..\inc\LCD320.h"
#define LCDCON1_ENVID (1)
#define LCDCON1_INVVD (1<<1)
#define LCDCON1_INVFRAME (1<<2)
#define LCDCON1_INVLINE (1<<3)
#define LCDCON1_INVCLK (1<<4)
#define LCDCON1_MMODE (1<<7)
#define L248 (8)
#define CLKVAL (10)
#define M5D(n) ((n) & 0x1fffff)
extern void Delay(int time);
//////////////////LCD Information//////////////
#define LCDColumn 40
#define LCDRow 20
int LCD_txt_Start_Address;
#define LCDTxtMode_TxtWidth 8
#define LCDTxtMode_TxtHeight 12
#define LCDMapMode_Width 56
#define LCDMapMode_Height 56
int LCD_start_AddressX;
int LCD_start_AddressY;
U8* pLCDBuffer16=(U8*)0xc000000;
U8 LCDBuffer[LCDHEIGHT][LCDWIDTH];
U32 LCDdspMode=DspTxtMode;
U8 LCDTxtData[128][12]={0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1c,0x10,0x10,0x10,0x10,0x10,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf0,0x10,0x10,0x10,0x10,0x10,
0x10,0x10,0x10,0x10,0x10,0x10,0x1c,0x0, 0x0, 0x0, 0x0, 0x0,
0x10,0x10,0x10,0x10,0x10,0x10,0xf0,0x0, 0x0, 0x0, 0x0, 0x0,
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfc,0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x30,0x78,0x78,0x78,0x30,0x0, 0x0, 0x0, 0x0,
0xfc,0xfc,0xfc,0xcc,0x84,0x84,0x84,0xcc,0xfc,0xfc,0xfc,0xfc,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x1c,0xc, 0xc, 0x14,0x10,0x30,0x48,0x48,0x30,0x0, 0x0,
0x0, 0x38,0x44,0x44,0x38,0x10,0x7c,0x10,0x10,0x10,0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0xc, 0x34,0x2c,0x34,0x24,0x24,0x2c,0x6c,0x60,0x0, 0x0,
0x0, 0x54,0x54,0x28,0x28,0x6c,0x28,0x28,0x54,0x54,0x0, 0x0,
0x10,0x10,0x10,0x10,0x10,0x10,0xfc,0x10,0x10,0x10,0x10,0x10,
0x0, 0x4, 0xc, 0x1c,0x3c,0x7c,0x3c,0x1c,0xc, 0x4, 0x0, 0x0,
0x10,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x10,0x0, 0x0,
0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x0, 0x28,0x28,0x0, 0x0,
0x3c,0x54,0x54,0x54,0x34,0x14,0x14,0x14,0x14,0x14,0x0, 0x0,
0x10,0x10,0x10,0x10,0x10,0x10,0xfc,0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfc,0x10,0x10,0x10,0x10,0x10,
0x10,0x10,0x10,0x10,0x10,0x10,0xf0,0x10,0x10,0x10,0x10,0x10,
0x10,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x0, 0x0,
0x10,0x10,0x10,0x10,0x10,0x10,0x1c,0x10,0x10,0x10,0x10,0x10,
0x0, 0x0, 0x0, 0x0, 0x8, 0x7c,0x8, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x20,0x7c,0x20,0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x20,0x20,0x20,0x20,0x20,0x20,0x0, 0x20,0x0, 0x0, //"!"
0x0, 0x28,0x50,0x50,0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, //"""
0x0, 0x0, 0x28,0x28,0xfc,0x28,0x50,0xfc,0x50,0x50,0x0, 0x0, //"#"
0x0, 0x20,0x78,0xa8,0xa0,0x60,0x30,0x28,0xa8,0xf0,0x20,0x0, //"$"
0x0, 0x0, 0x48,0xa8,0xb0,0x50,0x28,0x34,0x54,0x48,0x0, 0x0, //"%"
0x0, 0x0, 0x20,0x50,0x50,0x78,0xa8,0xa8,0x90,0x6c,0x0, 0x0, //"&"
0x0, 0x40,0x40,0x80,0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, //"'"
0x0, 0x4, 0x8, 0x10,0x10,0x10,0x10,0x10,0x10,0x8, 0x4, 0x0, //"("
0x0, 0x40,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x40,0x0, //")"
0x0, 0x0, 0x0, 0x20,0xa8,0x70,0x70,0xa8,0x20,0x0, 0x0, 0x0, //"*"
0x0, 0x0, 0x20,0x20,0x20,0xf8,0x20,0x20,0x20,0x0, 0x0, 0x0, //"+"
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40,0x40,0x80,//","
0x0, 0x0, 0x0, 0x0, 0x0, 0xf8,0x0, 0x0, 0x0, 0x0, 0x0, 0x0, //"-"
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40,0x0, 0x0, //"."
0x0, 0x8, 0x10,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x80,0x0, //"/"
0x0, 0x0, 0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x0, 0x0, //"0"
0x0, 0x0, 0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x0, 0x0, //"1"
// 0x00,0x10,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,
0x0, 0x0, 0x70,0x88,0x88,0x10,0x20,0x40,0x80,0xf8,0x0, 0x0, // 2
0x0, 0x0, 0x70,0x88,0x8, 0x30,0x8, 0x8, 0x88,0x70,0x0, 0x0, ////3
0x0, 0x0, 0x10,0x30,0x50,0x50,0x90,0x78,0x10,0x18,0x0, 0x0, //4
0x0, 0x0, 0xf8,0x80,0x80,0xf0,0x8, 0x8, 0x88,0x70,0x0, 0x0, //5
0x0, 0x0, 0x70,0x90,0x80,0xf0,0x88,0x88,0x88,0x70,0x0, 0x0, //6
0x0, 0x0, 0xf8,0x90,0x10,0x20,0x20,0x20,0x20,0x20,0x0, 0x0, //"7
0x0, 0x0, 0x70,0x88,0x88,0x70,0x88,0x88,0x88,0x70,0x0, 0x0, //8
0x0, 0x0, 0x70,0x88,0x88,0x88,0x78,0x8, 0x48,0x70,0x0, 0x0, //9
0x0, 0x0, 0x0, 0x0, 0x20,0x0, 0x0, 0x0, 0x0, 0x20,0x0, 0x0, //:
0x0, 0x0, 0x0, 0x0, 0x0, 0x20,0x0, 0x0, 0x0, 0x20,0x20,0x0, //;
0x0, 0x4, 0x8, 0x10,0x20,0x40,0x20,0x10,0x8, 0x4, 0x0, 0x0, //<
0x0, 0x0, 0x0, 0x0, 0xf8,0x0, 0x0, 0xf8,0x0, 0x0, 0x0, 0x0, //"=
0x0, 0x40,0x20,0x10,0x8, 0x4, 0x8, 0x10,0x20,0x40,0x0, 0x0, //">"
0x0, 0x0, 0x70,0x88,0x88,0x10,0x20,0x20,0x0, 0x20,0x0, 0x0, //"?"
0x0, 0x0, 0x70,0x88,0x98,0xa8,0xa8,0xb8,0x80,0x78,0x0, 0x0, //"@"
0x0, 0x0, 0x20,0x20,0x30,0x50,0x50,0x78,0x48,0xcc,0x0, 0x0, //"A"
0x0, 0x0, 0xf0,0x48,0x48,0x70,0x48,0x48,0x48,0xf0,0x0, 0x0, //"B"
0x0, 0x0, 0x78,0x88,0x80,0x80,0x80,0x80,0x88,0x70,0x0, 0x0, //"C"
0x0, 0x0, 0xf0,0x48,0x48,0x48,0x48,0x48,0x48,0xf0,0x0, 0x0, //"D"
0x0, 0x0, 0xf8,0x48,0x50,0x70,0x50,0x40,0x48,0xf8,0x0, 0x0, //"E"
0x0, 0x0, 0xf8,0x48,0x50,0x70,0x50,0x40,0x40,0xe0,0x0, 0x0, //"F"
0x0, 0x0, 0x38,0x48,0x80,0x80,0x9c,0x88,0x48,0x30,0x0, 0x0, //"G"
0x0, 0x0, 0xcc,0x48,0x48,0x78,0x48,0x48,0x48,0xcc,0x0, 0x0, //"H"
0x0, 0x0, 0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0, 0x0, //"I"
0x0, 0x0, 0x7c,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0xe0,0x0, //"J"
0x0, 0x0, 0xec,0x48,0x50,0x60,0x50,0x50,0x48,0xec,0x0, 0x0, //"K"
0x0, 0x0, 0xe0,0x40,0x40,0x40,0x40,0x40,0x44,0xfc,0x0, 0x0, //"L"
0x0, 0x0, 0xd8,0xd8,0xd8,0xd8,0xa8,0xa8,0xa8,0xa8,0x0, 0x0, //"M"
0x0, 0x0, 0xdc,0x48,0x68,0x68,0x58,0x58,0x48,0xe8,0x0, 0x0, //"N"
0x0, 0x0, 0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x0, 0x0, //"O"
0x0, 0x0, 0xf0,0x48,0x48,0x70,0x40,0x40,0x40,0xe0,0x0, 0x0, //"P"
0x0, 0x0, 0x70,0x88,0x88,0x88,0x88,0xe8,0x98,0x70,0x18,0x0, //"Q"
0x0, 0x0, 0xf0,0x48,0x48,0x70,0x50,0x48,0x48,0xec,0x0, 0x0, //"R"
0x0, 0x0, 0x78,0x88,0x80,0x60,0x10,0x8, 0x88,0xf0,0x0, 0x0, //"S"
0x0, 0x0, 0xf8,0xa8,0x20,0x20,0x20,0x20,0x20,0x70,0x0, 0x0, //"T"
0x0, 0x0, 0xcc,0x48,0x48,0x48,0x48,0x48,0x48,0x30,0x0, 0x0, //"U"
0x0, 0x0, 0xcc,0x48,0x48,0x50,0x50,0x30,0x20,0x20,0x0, 0x0, //"V"
0x0, 0x0, 0xa8,0xa8,0xa8,0x70,0x50,0x50,0x50,0x50,0x0, 0x0, //"W"
0x0, 0x0, 0xd8,0x50,0x50,0x20,0x20,0x50,0x50,0xd8,0x0, 0x0, //"X"
0x0, 0x0, 0xd8,0x50,0x50,0x20,0x20,0x20,0x20,0x70,0x0, 0x0, //"Y"
0x0, 0x0, 0xf8,0x90,0x10,0x20,0x20,0x40,0x48,0xf8,0x0, 0x0, //"Z"
0x0, 0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x0, //"["
0x0, 0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x8, 0x0, 0x0, //"\"
0x0, 0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x0, //"]"
0x0, 0x20,0x50,0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, //"^"
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfc,//"_"
0x0, 0x20,0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, //"."
0x0, 0x0, 0x0, 0x0, 0x0, 0x30,0x48,0x38,0x48,0x3c,0x0, 0x0, //"a"
0x0, 0x0, 0xc0,0x40,0x40,0x70,0x48,0x48,0x48,0x70,0x0, 0x0, //"b"
0x0, 0x0, 0x0, 0x0, 0x0, 0x38,0x48,0x40,0x40,0x38,0x0, 0x0, //"c"
0x0, 0x0, 0x18,0x8, 0x8, 0x38,0x48,0x48,0x48,0x3c,0x0, 0x0, //"d"
0x0, 0x0, 0x0, 0x0, 0x0, 0x30,0x48,0x78,0x40,0x38,0x0, 0x0, //"e"
0x0, 0x0, 0x1c,0x20,0x20,0x78,0x20,0x20,0x20,0x78,0x0, 0x0, //"f"
0x0, 0x0, 0x0, 0x0, 0x0, 0x3c,0x48,0x30,0x40,0x78,0x44,0x38,//"g"
0x0, 0x0, 0xc0,0x40,0x40,0x70,0x48,0x48,0x48,0xec,0x0, 0x0, //"h"
0x0, 0x0, 0x20,0x0, 0x0, 0x60,0x20,0x20,0x20,0x70,0x0, 0x0, //"i"
0x0, 0x0, 0x10,0x0, 0x0, 0x30,0x10,0x10,0x10,0x10,0x10,0xe0,//"j"
0x0, 0x0, 0xc0,0x40,0x40,0x5c,0x50,0x70,0x48,0xec,0x0, 0x0, //"k"
0x0, 0x0, 0xe0,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0, 0x0, //"l"
0x0, 0x0, 0x0, 0x0, 0x0, 0xf0,0xa8,0xa8,0xa8,0xa8,0x0, 0x0, //"m"
0x0, 0x0, 0x0, 0x0, 0x0, 0xf0,0x48,0x48,0x48,0xec,0x0, 0x0, //"n"
0x0, 0x0, 0x0, 0x0, 0x0, 0x30,0x48,0x48,0x48,0x30,0x0, 0x0, //"o"
0x0, 0x0, 0x0, 0x0, 0x0, 0xf0,0x48,0x48,0x48,0x70,0x40,0xe0,//"p"
0x0, 0x0, 0x0, 0x0, 0x0, 0x38,0x48,0x48,0x48,0x38,0x8, 0x1c,//"q"
0x0, 0x0, 0x0, 0x0, 0x0, 0xd8,0x60,0x40,0x40,0xe0,0x0, 0x0, //"r"
0x0, 0x0, 0x0, 0x0, 0x0, 0x78,0x40,0x30,0x8, 0x78,0x0, 0x0, //"s"
0x0, 0x0, 0x0, 0x20,0x20,0x70,0x20,0x20,0x20,0x18,0x0, 0x0, //"t"
0x0, 0x0, 0x0, 0x0, 0x0, 0xd8,0x48,0x48,0x48,0x3c,0x0, 0x0, //"u"
0x0, 0x0, 0x0, 0x0, 0x0, 0xec,0x48,0x50,0x30,0x20,0x0, 0x0, //"v"
0x0, 0x0, 0x0, 0x0, 0x0, 0xa8,0xa8,0x70,0x50,0x50,0x0, 0x0, //"w"
0x0, 0x0, 0x0, 0x0, 0x0, 0xd8,0x50,0x20,0x50,0xd8,0x0, 0x0, //"x"
0x0, 0x0, 0x0, 0x0, 0x0, 0xec,0x48,0x50,0x30,0x20,0x20,0xc0,//"y"
0x0, 0x0, 0x0, 0x0, 0x0, 0x78,0x10,0x20,0x20,0x78,0x0, 0x0, //"z"
0x0, 0x18,0x10,0x10,0x10,0x20,0x10,0x10,0x10,0x10,0x18,0x0, //{
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,//|
0x0, 0x60,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0x60,0x0, //}
0x40,0xa4,0x18,0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, //"~"
};
void LCD_Init()
{
int i;
U32 LCDBASEU,LCDBASEL,LCDBANK;
LCDDisplayOpen(FALSE);
for(i=0;i<40*240;i++)
*(pLCDBuffer16+i)=0x0;
/////////////初始化LCD端口/////////////
/* PORT D GROUP for LCD */
/* I I I I O O O O */
/* 00 00 00 00 01 01 01 01 */
rPDATD= 0xff;
rPCOND= 0xaaaa;
rPUPD = 0x0;
rPCONE|=0x01;
rPCONC = 0x5f51ff00;
// rPDATC=0x00;
LCDDisplayOpen(FALSE);
/////////////////////////////////////
rLCDCON1=(0);//|(1<<5)|(0x3<<8)|(0x3<<10)|(CLKVAL<<12);
// disable,4B_SNGL_SCAN,WDLY=16clk,WLH=16clk,CLKVAL=?
rLCDCON2=(240-1)|(119<<10)|(15<<21);
// LINEVAL=420-1 HOZVAL=320/4-1=79;LINEBANK=10;
//320x240LCD LINEBLANK=10 (without any calculation)
LCDBANK=0xc000000>>22;//((U32)pLCDBuffer16)>>22;
LCDBASEU=0x0;//((U32)pLCDBuffer16)&0x3fffff;
LCDBASEL=LCDBASEU+160*240;//LCDBASEU+(320*8/16+0)*240
// LCDBASEL =LCDBASEU + (PAGEWIDTH + OFFSIZE) x (LINEVAL +1)
rLCDSADDR1= (0x3<<27) |(LCDBANK<<21)|LCDBASEU;//| ((((U32)LCDBuffer16)>>1)&0x7ffffff);
// color mode, LCDBANK, LCDBASEU
rLCDSADDR2= (0<<29)|(0<<21)|LCDBASEL;
rLCDSADDR3= (160) | ( 0<<9 );//(320*8/16)|( 0<<9 )
//No virtual screen.
rREDLUT=0xfca86420;
rGREENLUT=0xfca86420;
rBLUELUT=0xfffffa50;
//The following value has to be changed for better display.
//Select 4 levels among 16 gray levels.
rLCDCON1=LCDCON1_ENVID|(2<<5)|(1<<7)|(0x3<<8)|(0x3<<10)|(CLKVAL<<12);//|LCDCON1_MMODE;
// enable,4B_SNGL_SCAN,WDLY=16clk,WLH=16clk,CLKVAL=?
Delay(2000);
LCDBkLight(TRUE);
LCDDisplayOpen(TRUE);
}
void LCD_ChangeMode(U8 mode)
{
LCDdspMode=mode;
}
void LCDBkLight(U8 isOpen)
{
if(isOpen){
rPDATC&=~LCDBkLightPin;
}
else{
rPDATC|=LCDBkLightPin;
}
}
void LCDDisplayOpen(U8 isOpen)
{
if(isOpen){
rPDATC&=~LCDDisplayPin;//0x0;
}
else{
rPDATC|=LCDDisplayPin;//0x400;
}
}
U8 LCDTxtBuffer[LCDRow][LCDColumn];
int LCDCurrentPrnTxt=0; //打印文本所在的行
U8 LCDIsprnOverPage=FALSE; //是否滚动屏幕
void LCD_TxtRefresh(int LCDCurrentDspTxt)
{
int i,j,showrow;
unsigned int data;
U8 txtdata;
unsigned char *pLCDBuffer=(unsigned char *)pLCDBuffer16;
for(j=0;j<LCDHEIGHT;j++){
for(i=0;i<LCDColumn;i++){
data=0;
showrow=LCDCurrentDspTxt+j/LCDTxtMode_TxtHeight;
if(showrow>LCDRow-1)
showrow-=LCDRow;
txtdata=LCDTxtBuffer[showrow][i];
if(txtdata>=128)
txtdata=' ';
txtdata=LCDTxtData[txtdata][j%LCDTxtMode_TxtHeight];
*pLCDBuffer=((txtdata>>4)&0x1)*0xff;
pLCDBuffer++;
*pLCDBuffer=((txtdata>>5)&0x1)*0xff;
pLCDBuffer++;
*pLCDBuffer=((txtdata>>6)&0x1)*0xff;
pLCDBuffer++;
*pLCDBuffer=((txtdata>>7)&0x1)*0xff;
pLCDBuffer++;
*pLCDBuffer=((txtdata)&0x1)*0xff;
pLCDBuffer++;
*pLCDBuffer=((txtdata>>1)&0x1)*0xff;
pLCDBuffer++;
*pLCDBuffer=((txtdata>>2)&0x1)*0xff;
pLCDBuffer++;
*pLCDBuffer=((txtdata>>3)&0x1)*0xff;
pLCDBuffer++;
}
}
}
void LCD_Printf(const char *format,...)
{
char tbuf[256];
int i,j=0;
int LCDCurrentDspTxt=0;
va_list v_list;
char *ptr;
va_start(v_list, format); // Initialize variable arguments.
vsprintf(tbuf, format, v_list );
va_end(v_list);
ptr= tbuf;
if(LCDdspMode!=DspTxtMode)
return;
/*格式化字符串*/
for(i=0;ptr[i]!=0;i++){
if(ptr[i]=='\n'){ //换行
LCDCurrentPrnTxt++;
if(LCDCurrentPrnTxt>LCDRow-1){
LCDCurrentPrnTxt-=LCDRow;
LCDIsprnOverPage=TRUE;
}
if(LCDIsprnOverPage)
LCDCurrentDspTxt=LCDCurrentPrnTxt;
for(;j<LCDColumn;j++) //补齐空格
LCDTxtBuffer[LCDCurrentPrnTxt][j]=0;
j=0;
}
else{
if(j<LCDColumn)
LCDTxtBuffer[LCDCurrentPrnTxt][j++]=ptr[i];
}
}
LCD_TxtRefresh(LCDCurrentDspTxt);
}
void LCD_Column_Row(int m_Row,int m_Colum,U8 m_k)
{
int j;
int m_c;
m_c=(m_Colum/4)*4+(3-m_Colum%4)+LCDTxtMode_TxtHeight*LCDCurrentPrnTxt*40+LCD_txt_Start_Address*8;
for( j=0;j<12;j++)
{
*(pLCDBuffer16+m_Row*12*40+j*40+m_c)=LCDTxtData[m_k][j];
}
}
void LCD_Refresh()
{
int i,j;
U32 lcddata;
U32 pixcolor; //一个像素点的颜色
U8* pbuf=(U8*)LCDBuffer[0];
for(i=0;i<LCDWIDTH*LCDHEIGHT;i++){
lcddata=0;
for(j=24;j>=0;j-=8){
pixcolor=(pbuf[0]&0xe0)|((pbuf[1]>>3)&0x1c)|(pbuf[2]>>6); //变换RGB
lcddata|=pixcolor<<j;
pbuf+=4;
}
*(pLCDBuffer16+i)=lcddata;
}
}
//文本模式下清除屏幕?
void LCD_Cls()
{
LCDCurrentPrnTxt=0, //打印文本所在的行
LCDIsprnOverPage=FALSE;
memset(LCDTxtBuffer,0,LCDRow*LCDColumn*12);
LCD_Refresh();
}
void LCD_ShowMove(int m_bit)
{
int i,j,z,x=0,m_Row;
U8 data,data1,data2,data3;
U8 d1;
data=data1=data2=data3=0;
for(j=0;j<m_bit;j++)
{
for(x=0;x<LCDRow;x++)
{
m_Row=x*40*12;
for(i=0;i<LCDColumn/4;i++) //列数循环
{
for(z=0;z<LCDTxtMode_TxtHeight;z++)
{
d1=3+(i+1)*4;
if(i==9)
{
data=0;
}else{
data=*(pLCDBuffer16+d1+LCDColumn*z+m_Row);
}
data1=*(pLCDBuffer16+d1-7+LCDColumn*z+m_Row);
data2=*(pLCDBuffer16+d1-6+LCDColumn*z+m_Row);
data3=*(pLCDBuffer16+d1-5+LCDColumn*z+m_Row);
*(pLCDBuffer16+i*4+LCDColumn*z+m_Row)=data;
*(pLCDBuffer16+1+i*4+LCDColumn*z+m_Row)=data1;
*(pLCDBuffer16+2+i*4+LCDColumn*z+m_Row)=data2;
*(pLCDBuffer16+3+i*4+LCDColumn*z+m_Row)=data3;
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -