微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > s3c2440之LCD字符显示

s3c2440之LCD字符显示

时间:11-11 来源:互联网 点击:

#define U32 unsigned int

#define M5D(n) ((n) & 0x1fffff)

#define rGPCCON (*(volatile unsigned *)0x56000020)
#define rGPCDAT (*(volatile unsigned *)0x56000024)
#define rGPCUP (*(volatile unsigned *)0x56000028)

#define rGPDCON (*(volatile unsigned *)0x56000030)

#define rGPDDAT (*(volatile unsigned *)0x56000034)

#define rGPDUP (*(volatile unsigned *)0x56000038)

#define rGPGCON (*(volatile unsigned *)0x56000060)

#define rGPGDAT (*(volatile unsigned *)0x56000064)

#define rGPGUP (*(volatile unsigned *)0x56000068)

#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 rTCONSEL (*(volatile unsigned *)0x4d000060)

#define LCD_WIDTH 320

#define LCD_HEIGHT 240

#define VSPW (3-1)

#define VBPD (15-1)

#define VFPD (12-1)

#define HSPW (30-1)

#define HBPD (38-1)

#define HFPD (20-1)

#define LINEVAL (LCD_HEIGHT-1)

#define HOZVAL (LCD_WIDTH-1)

/*for LCDCON1*/

#define CLKVAL_TFT 6

#define MVAL_USED 0

#define PNRMODE_TFT 3

#define BPPMODE_TFT 13


/*for LCDCON5*/

#define BPP24BL 0

#define INVVCLK 0

#define INVVLINE 1

#define INVVFRAME 1

#define INVVD 0

#define INVVDEN 0

#define PWREN 1

#define BSWP 0

#define HWSWP 0

volatile U32 LCD_BUFFER[LCD_HEIGHT][LCD_WIDTH];

unsigned char ning[]= /*宁*/

{
0x00,0x60,0x00,0x00,0x30,0x00,0x00,0x18,0x00,0x10,0x10,0x0C,0x1F,0xFF,0xFE,0x30,0x00,0x18,0x30,0x00,0x10,0x60,0x00,0x20,
0x00,0x00,0x00,0x00,0x00,0x18,0x7F,0xFF,0xFC,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,
0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x01,0xF8,0x00,0x00,0x70,0x00,0x00,0x20,0x00
};

unsigned char bo[]= /*波*/

{

0x00,0x02,0x00,0x30,0x03,0x80,0x18,0x03,0x00,0x0C,0x03,0x00,0x08,0x83,0x0C,0x00,0xFF,0xFE,0x42,0xC3,0x0C,0x62,0xC3,0x18,
0x32,0xC3,0x20,0x34,0xC3,0x00,0x14,0xC3,0x10,0x04,0xFF,0xF8,0x08,0xC8,0x30,0x08,0xC8,0x60,0x18,0xC4,0x60,0x78,0xC4,0xC0,
0x18,0xC2,0xC0,0x18,0xC3,0x80,0x31,0x83,0x80,0x31,0x86,0xC0,0x33,0x0C,0x70,0x12,0x30,0x3E,0x04,0xC0,0x18,0x09,0x00,0x00

};

unsigned char da[]= /*大*/

{

0x00,0x20,0x00,0x00,0x38,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x10,0x00,0x30,0x38,
0x3F,0xFF,0xFC,0x00,0x38,0x00,0x00,0x68,0x00,0x00,0x64,0x00,0x00,0x64,0x00,0x00,0xC6,0x00,0x00,0xC2,0x00,0x01,0x83,0x00,
0x01,0x81,0x80,0x03,0x00,0xC0,0x06,0x00,0xF0,0x0C,0x00,0x78,0x18,0x00,0x3E,0x20,0x00,0x18,0x40,0x00,0x00,0x00,0x00,0x00,

};
unsigned char xue[]= /*学*/
{

0x00,0x20,0x00,0x08,0x30,0x40,0x04,0x10,0xF0,0x06,0x18,0xC0,0x03,0x18,0x80,0x03,0x11,0x80,0x12,0x01,0x0C,0x1F,0xFF,0xFE,
0x30,0x00,0x0C,0x70,0x00,0x18,0x60,0x00,0xD0,0x07,0xFF,0xE0,0x00,0x01,0x80,0x00,0x16,0x00,0x00,0x18,0x00,0x00,0x18,0x0C,
0x7F,0xFF,0xFE,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x01,0xF8,0x00,0x00,0x70,0x00,0x00,0x20,0x00

};

unsigned char ASCII_A[]= /*A*/

{
0x00, 0x00, 0x00, 0x10, 010, 0x18, 0x28, 0x28, 0x24, 0x3C, 0x44, 0x42, 0x42, 0xE7, 0x00, 0x00

};

unsigned char ASCII_R[]= /*R*/

{

0x00, 0x00, 0x00, 0xFC, 0x42, 0x42, 0x42, 0x7C, 0x48, 0x48, 0x44, 0x44, 0x42, 0xE3, 0x00, 0x00

};

unsigned char ASCII_M[]= /*M*/

{

0x00, 0x00, 0x00, 0xEE, 0x6C, 0x6C, 0x6C, 0x6C, 0x54, 0x54, 0x54, 0x54, 0x54, 0xD6, 0x00, 0x00

};

/*绘制背景*/

void Brush_Background( U32 c)

{

int x,y ;

for( y = 0 ; y < LCD_HEIGHT ; y++ )

{

for( x = 0 ; x < LCD_WIDTH ; x++ )

{

LCD_BUFFER[y][x] = c ;

}

}

}

/*绘制像素点*/

void PutPixel(U32 x,U32 y, U32 c )

{

LCD_BUFFER[y][x] = c;

}

/*绘制大小为24×24的中文字符*/
/*把LCD看成点阵,将数组char[]中的数据读出,即点亮像素点,像素点颜色有自己来定,即通过PutPixel()函数来给要显示的文字上色。每一个中文字符都是由24×24个像素点(可以认为是点阵),本代码逐行扫描每行,先从左到右,在从上到下扫描点亮像素点。中文字符的宽度与ASCII码字符宽度不同,一般ASCII字符宽度是中文字符的一半。在字符取模的时候,尽量宽和高都取成8的倍数,这样读取字符2进制数组时比较容易

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top