您的位置 首页 芯闻

S3C2440-LCD字符显现

LCD字符显示有两种方式,一个是通过字模提取软件,将字符转化成一个字节型的数组,另一个是使用字库。如果字符较多的时候,直接使用字库比

LCD字符显现有两种方法,一个是经过字模提取软件,将字符转化成一个字节型的数组,另一个是运用字库。假如字符较多的时分,直接运用字库比较便利。现在说一下中英文字符的存储结构和编码方法。中英文的字符点阵结构有4*8,8*16,16*16,24*24,32*32,48*48等结构局势,不同点阵汉字的字体又有宋体,仿宋体,黑体,楷体等之分。在计算机中,相同点阵结构和相同字体的字符寄存在同一字库中。本文运用的是16*16的宋体。16*16的点阵字库中,字符的信息结构采用以行摆放的方法,共有16行,每行有16个点,别离寄存在两个字节内。因而每个字符共占用16*16/2=32个字节。字节的寄存次序为从左到右,从上到下。将汉字变成字符形式,运用16*16个像素表明一个汉字。在字模提取的过程中,还要留意取模的次序,次序不同,得到的数组就不同,一般式从左向右,从上到下。取模方法,逐行式。ASCII型字符的宽度是汉字的一半,即8。

#define rGPCCON (*(volatile unsigned *)0x56000020)
#define rGPCUP (*(volatile unsigned *)0x56000028)
#define rGPDCON (*(volatile unsigned *)0x56000030)
#define rGPDUP (*(volatile unsigned *)0x56000038)
#define rLCDCON1 (*(volatile unsigned *)0x4d000000)
#define rLCDCON2 (*(volatile unsigned *)0x4d000004)
#define rLCDCON3 (*(volatile unsigned *)0x4d000008)
#define rLCDCON4 (*(volatile unsigned *)0x4d00000c)
#define rLCDCON5 (*(volatile unsigned *)0x4d000010)
#define rLCDSADDR1 (*(volatile unsigned *)0x4d000014)
#define rLCDSADDR2 (*(volatile unsigned *)0x4d000018)
#define rLCDSADDR3 (*(volatile unsigned *)0x4d00001c)
#define rLCDINTMSK (*(volatile unsigned *)0x4d00005c)
#define rTPAL (*(volatile unsigned *)0x4d000050)
#define rGPGCON (*(volatile unsigned *)0x56000060) //Port G control
#define rGPGDAT (*(volatile unsigned *)0x56000064) //Port G data
#define rGPGUP (*(volatile unsigned *)0x56000068) //Pull-up control G
#define rLCDINTMSK (*(volatile unsigned *)0x4d00005c)
#define rTCONSEL (*(volatile unsigned *)0x4d000060) //LPC3600 Control — edited by junon
//笔直同步信号的脉宽、后肩和前肩
#define VSPW 15
#define VBPD 3
#define VFPD 5
//水平同步信号的脉宽、后肩和前肩
#define HSPW 8
#define HBPD 58
#define HFPD 15
#define CLKVAL 10
#define HOZVAL 319
#define LINEVAL 239
#define PWREN 1
#define MMODE 0
#define PNRMODE 3
#define BPPMODE 13
#define INVVCLK 0
#define INVVD 0
#define INVVDEN 0
#define U32 unsigned int
#define M5D(n) ((n) & 0x1fffff)
#define PAGEWIDTH 320
#define OFFSIZE 0
#define LCD_XSIZE 320
#define LCD_YSIZE 240
#define SCR_XSIZE 320
#define SCR_YSIZE 240
#define INVVLINE 1
#define INVVFRAME 1
#define BPP24BL 0
#define BSWP 0
#define HWSWP 0
volatile U32 LCD_BUFFER[240][320];
unsigned char li[]={
0x01,0x00,0x01,0x00,0x7F,0xFC,0x03,0x80,0x05,0x40,0x09,0x30,0x31,0x0E,0xDF,0xE4,
0x00,0x80,0x01,0x00,0x7F,0xFE,0x01,0x00,0x01,0x00,0x01,0x00,0x05,0x00,0x02,0x00}; //”李”,0
unsigned char wan[]={
0x00,0x00,0x7F,0xFE,0x02,0x00,0x02,0x00,0x02,0x10,0x03,0xF8,0x02,0x10,0x04,0x10,
0x04,0x10,0x04,0x10,0x08,0x10,0x08,0x10,0x10,0x10,0x20,0xE0,0x40,0x40,0x00,0x00}; //”万”,1
unsigned char peng[]={
0x00,0x10,0x77,0x20,0x55,0x7C,0x55,0x64,0x77,0x54,0x55,0x54,0x55,0x4C,0x55,0x40,
0x77,0x7E,0x55,0x02,0x55,0x02,0x55,0xFA,0x55,0x02,0xB9,0x14,0x13,0x08,0x00,0x00}; //”鹏”,2
unsigned char L[]={0X00,0X00,0X00,0XE0,0X40,0X40,0X40,0X40,0X40,0X40,0X40,0X40,0X42,0XFE,0X00,0X00}; //L
unsigned char I[]={0X00,0X00,0X00,0X7C,0X10,0X10,0X10,0X10,0X10,0X10,0X10,0X10,0X10,0X7C,0X00,0X00}; //I
unsigned char N[]={0X00,0X00,0X00,0XC7,0X62,0X62,0X52,0X52,0X4A,0X4A,0X4A,0X46,0X46,0XE2,0X00,0X00}; //N
unsigned char U[]={0X00,0X00,0X00,0XE7,0X42,0X42,0X42,0X42,0X42,0X42,0X42,0X42,0X42,0X3C,0X00,0X00}; //U
unsigned char X[]={0X00,0X00,0X00,0XE7,0X42,0X24,0X24,0X18,0X18,0X18,0X24,0X24,0X42,0XE7,0X00,0X00}; //X
unsigned char AND[]={0X00,0X00,0X00,0X30,0X48,0X48,0X48,0X50,0X6E,0XA4,0X94,0X88,0X89,0X76,0X00,0X00}; //&
unsigned char A[]={0X00,0X00,0X00,0X10,0X10,0X18,0X28,0X28,0X24,0X3C,0X44,0X42,0X42,0XE7,0X00,0X00}; //A
unsigned char R[]={0X00,0X00,0X00,0XFC,0X42,0X42,0X42,0X7C,0X48,0X48,0X44,0X44,0X42,0XE3,0X00,0X00}; //R
unsigned char M[]={0X00,0X00,0X00,0XEE,0X6C,0X6C,0X6C,0X6C,0X54,0X54,0X54,0X54,0X54,0XD6,0X00,0X00}; //M
void Init_LCD(){
rLCDCON1=(CLKVAL<<8)|(MMODE<<7)|(PNRMODE<<5)|(BPPMODE<<1)|0; //设置CLKVAL,VCLK=HCLK/[(CLKVAL+1)*2],决议VM的触发方法,挑选显现形式和BPP形式,暂时不要敞开LCD,由于还没有设置好
rLCDCON2=(VBPD<<24)|(LINEVAL<<14)|(VFPD<<6)|(VSPW); //rLCDCON2,rLCDCON3和rLCDCON4首要设置时序
rLCDCON3=(HBPD<<19)|(HOZVAL<<8)|(HFPD);
rLCDCON4=(HSPW);
rLCDCON5 = (BPP24BL<<12) | (INVVCLK<<10) | (INVVLINE<<9) | (INVVFRAME<<8) | (0<<7) | (INVVDEN<<6) | (PWREN<<3) |(BSWP<<1) | (HWSWP); //INVVLINE和INVVFRAME需求进行翻转,由于CPU宣布的是正脉冲,LCD运用的是负脉冲,所以要改动极性,PWREN使能电源信号
rLCDSADDR1=(((U32)LCD_BUFFER>>22)<<21)|M5D((U32)LCD_BUFFER>>1);
rLCDSADDR2=M5D(((U32)LCD_BUFFER+(SCR_XSIZE*SCR_YSIZE*4))>>1 );
rLCDSADDR3=PAGEWIDTH*32/16;
rLCDINTMSK|=(3);
rTCONSEL = 0;
rGPCUP = 0x0;
rGPDCON = 0xaaaaaaaa;
rGPCCON = 0xaaaa02a9;
rGPDUP = 0x0;
rGPGUP=rGPGUP&(“(1<<4))|(1<<4);
rGPGCON=rGPGCON&(“(3<<8))|(3<<8);
rLCDCON1 |= 1; //使能数据输出和LCD操控信号
}

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/news/xinwen/254709.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部