📄 t6963init.#1
字号:
/********************************************
* Filename: t6963init.h *
* *
* Description: Header file for t6963.c *
* *
* *
* Date: 06/02/2003 *
*******************************************/
//-----------------------------------------------------------------------------
// LCD的常量定义
//-----------------------------------------------------------------------------
/* Pragmas */
//#pragma CLOCK_FREQ 4000000
//#include <C8051F020.H>
/* LCD Parameters */
//#define LCD_TEXT_WIDTH 0x1E /* Text Width = Graphics Width / Character Width */
//#define LCD_TEXT_WIDTH 0x20 //MODIFY
//#define LCD_TEXT_HEIGHT 0x10 //MODIFY
//#define LCD_TEXT_HEIGHT 0x08 /* Text Height = Graphics Height / Character Height */
//#define LCD_GRAPHICS_WIDTH 0xF0 /* Width of display (0xA0 = 240 pixels) */
//#define LCD_GRAPHICS_HEIGHT 0x80 /* Height of display (0x80 = 128 pixels) */
//#define LCD_NUMBER_OF_SCREENS 0x02 /* for > 68 pixels height, is probably split into 2 screens */
#define LCD_CHARACTER_WIDTH 0x08 /* Is character 8x8 or 6x8 (0x08 / 0x06) */
#define LCD_TEXT_HOME 0x0000 /* Graphics Area + Text Attribute Size (same size as text size) */
#define LCD_TEXT_AREA 0x1E /* Text line is 30 chars wide */
#define LCD_TEXT_SIZE 0x01E0 /* Size of text RAM */ /* into 2 screens */
/* Define the Memory Map */
#define LCD_GRAPHICS_HOME 0x01E0 /* This will usually be at the start of RAM */
//#define LCD_GRAPHICS_AREA 0x1E /* A graphic character is 8 bits wide (same as 8x8 char) */
#define LCD_GRAPHICS_AREA 0x1E //MODIFY
//#define LCD_GRAPHICS_SIZE 0x0800 /* Size of graphics RAM */
#define LCD_GRAPHICS_SIZE 0x0F00
/* Memory Map for 240x128 pixel display */
/* This display is made up of two screens */
/* Both 240x64 pixels */
/* Screen 1 */
/* 0x0000 ----------------------------- */
/* | Graphic RAM Area | */
/* | 0x0000 to 0x07FF | */
/* | (256x64 pixels) | */
/* 0x0800 ----------------------------- */
/* | Text Attribute Area | */
/* 0x0A00 ----------------------------- */
/* | Text RAM Area | */
/* | 512 Bytes | */
/* | (256x64 pixels) | */
/* 0x0C00 ----------------------------- */
/* Screen 2 (Automatically derived from Screen 1) */
/* 0x8000 ----------------------------- */
/* | Graphic RAM Area | */
/* | 0x0000 to 0x07FF | */
/* | (256x64 pixels) | */
/* 0x8800 ----------------------------- */
/* | Text Attribute Area | */
/* 0x8A00 ----------------------------- */
/* | Text RAM Area | */
/* | 512 Bytes | */
/* | (256x64 pixels) | */
/* 0x8C00 ----------------------------- */
/* LCD Data Bus Pins */
#define LCD_DATA_BUS P7
#define LCD_DATA_BUS_TRIS P74OUT
/* LCD Control Pins */
#define LCD_CONTROL P2
#define LCD_CONTROL_TRIS P2MDOUT
#define LCD_WR_BIT 0x07
#define LCD_RD_BIT 0x06
#define LCD_CE_BIT 0x02
#define LCD_CD_BIT 0x03
#define LCD_RST_BIT 0x04
#define LCD_WR 0x80
#define LCD_RD 0x40
#define LCD_CE 0x04
#define LCD_CD 0x08
#define LCD_RST 0x10
/* Control Word Definitions */
#define LCD_CURSOR_POINTER_SET 0x21
#define LCD_OFFSET_REGISTER_SET 0x22
#define LCD_ADDRESS_POINTER_SET 0x24
#define LCD_TEXT_HOME_ADDRESS_SET 0x40
#define LCD_TEXT_AREA_SET 0x41
#define LCD_GRAPHIC_HOME_ADDRESS_SET 0x42
#define LCD_GRAPHIC_AREA_SET 0x43
#define LCD_CG_ROM_MODE_OR 0x80
#define LCD_CG_ROM_MODE_EXOR 0x81
#define LCD_CG_ROM_MODE_AND 0x83
#define LCD_CG_ROM_MODE_TEXT 0x84
#define LCD_CG_RAM_MODE_OR 0x88
#define LCD_CG_RAM_MODE_EXOR 0x89
#define LCD_CG_RAM_MODE_AND 0x8B
#define LCD_CG_RAM_MODE_TEXT 0x8C
/* 1001 0000 is all off, OR together for ON modes */
#define LCD_DISPLAY_MODES_ALL_OFF 0x90
#define LCD_DISPLAY_MODES_GRAPHICS_ON 0x98
#define LCD_DISPLAY_MODES_TEXT_ON 0x94
#define LCD_DISPLAY_MODES_CURSOR_ON 0x92
#define LCD_DISPLAY_MODES_CURSOR_BLINK 0x91
/* Cursor Pattern Select */
#define LCD_CURSOR_PATTERN_UNDERLINE 0xA0
#define LCD_CURSOR_PATTERN_BLOCK 0xA7
/* Send Auto_XX Command, then block of data, then Auto_reset */
#define LCD_DATA_AUTO_WRITE_SET 0xB0
#define LCD_DATA_AUTO_READ_SET 0xB1
#define LCD_DATA_AUTO_RESET 0xB2
/* Send R/W Then one byte Data */
#define LCD_DATA_WRITE_AUTO_INCREMENT 0xC0
#define LCD_DATA_READ_AUTO_INCREMENT 0xC1
#define LCD_DATA_WRITE_NO_INCREMENT 0xC4
#define LCD_DATA_READ_NO_INCREMENT 0xC5
/* Status Register Bits */
#define LCD_STATUS_BUSY1 0x01
#define LCD_STATUS_BUSY2 0x02
#define LCD_STATUS_DARRDY 0x04
#define LCD_STATUS_DAWRDY 0x08
#define LCD_STATUS_CLR 0x20
#define LCD_STATUS_ERR 0x40
#define LCD_STATUS_BLINK 0x80
/* Definitions */
#define ALL_INPUTS 0x3F
#define ALL_OUTPUTS 0xC0
struct CNode{ //汉字显示结点结构体声明
char ch[2];//字体存放单元
unsigned char dat[32];//汉字字模存放单元
};
struct CNode code newhanzi[]=
{
{"欢",
0x00,0x80,0x00,0x80,0xFC,0x80,0x05,0xFE,0x85,0x04,0x4A,0x48,0x28,0x40,0x10,0x40,
0x18,0x40,0x18,0x60,0x24,0xA0,0x24,0x90,0x41,0x18,0x86,0x0E,0x38,0x04,0x00,0x00,
},
{"迎",
0x40,0x00,0x21,0x80,0x36,0x7C,0x24,0x44,0x04,0x44,0x04,0x44,0xE4,0x44,0x24,0x44,
0x25,0x44,0x26,0x54,0x24,0x48,0x20,0x40,0x20,0x40,0x50,0x00,0x8F,0xFE,0x00,0x00,
},
{"使",
0x08,0x40,0x0C,0x40,0x1B,0xFE,0x10,0x40,0x37,0xFC,0x64,0x44,0xA4,0x44,0x27,0xFC,
0x24,0x44,0x22,0x40,0x21,0x80,0x20,0x80,0x21,0x70,0x22,0x1E,0x2C,0x04,0x00,0x00,
},
{"用",
0x00,0x00,0x1F,0xFC,0x10,0x84,0x10,0x84,0x10,0x84,0x1F,0xFC,0x10,0x84,0x10,0x84,
0x10,0x84,0x1F,0xFC,0x10,0x84,0x10,0x84,0x20,0x84,0x20,0x84,0x40,0x94,0x80,0x88,
},
{"片",
0x00,0x40,0x10,0x40,0x10,0x40,0x10,0x44,0x1F,0xFE,0x10,0x00,0x10,0x00,0x10,0x00,
0x1F,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x10,0x20,0x10,0x40,0x10,0x80,0x10,
},
{"上",
0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0xF8,0x01,0x00,
0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x04,0x7F,0xFE,0x00,0x00,
},
{"数",
0x08,0x20,0x49,0x30,0x2A,0x20,0x1C,0x20,0xFF,0x7E,0x1C,0x44,0x2B,0x44,0x48,0xC4,
0x08,0x28,0xFF,0x28,0x12,0x10,0x34,0x10,0x0C,0x28,0x32,0x4E,0xC0,0x84,0x00,0x00,
},
{"采",
0x00,0x00,0x01,0xF8,0x7E,0x00,0x00,0x10,0x11,0x10,0x08,0xA0,0x01,0x00,0x7F,0xFE,
0x01,0x80,0x03,0x40,0x05,0x20,0x09,0x18,0x31,0x0E,0xC1,0x04,0x01,0x00,0x01,0x00,
},
{"系",
0x00,0x7C,0x3F,0x80,0x02,0x20,0x04,0x20,0x08,0x40,0x1F,0x80,0x03,0x20,0x0C,0x10,
0x3F,0xF8,0x10,0x8C,0x04,0xA0,0x08,0x90,0x10,0x88,0x20,0x84,0x42,0x84,0x01,0x00,
},
{"统",
0x10,0x40,0x10,0x20,0x23,0xFE,0x20,0x40,0x44,0x40,0xF8,0x88,0x09,0x04,0x13,0xFE,
0x20,0x94,0x7C,0x90,0x00,0x90,0x00,0x90,0x1D,0x12,0xE1,0x12,0x02,0x0E,0x04,0x00,
},
{"A",
0x00,0x00,0x00,0x10,0x10,0x18,0x28,0x28,0x24,0x3C,0x44,0x42,0x42,0xE7,0x00,0x00,
},
{"D",
0x00,0x00,0x00,0xF8,0x44,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x44,0xF8,0x00,0x00,
},
{"样",
0x11,0x08,0x10,0x88,0x10,0x90,0xFD,0xFE,0x10,0x20,0x30,0x20,0x39,0xFC,0x54,0x20,
0x50,0x20,0x90,0x20,0x13,0xFE,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,
},
{"值",
0x10,0x40,0x18,0x60,0x17,0xFC,0x10,0x40,0x20,0x80,0x33,0xF8,0x62,0x08,0xA3,0xF8,
0x22,0x08,0x23,0xF8,0x22,0x08,0x23,0xF8,0x22,0x08,0x22,0x08,0x2F,0xFE,0x20,0x00,
},
{":",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x30,0x00,0x30,0x00,0x00,0x00,0x30,0x00,0x30,0x00,0x00,0x00,0x00,0x00,
},
};
//void interupt(void);
void lcd_initialise(void);
void lcd_write_data(unsigned char lwd_data);
//unsigned char lcd_read_data(void);
void lcd_write_command(unsigned char lwc_data);
unsigned char lcd_read_status(void);
void lcd_clear_graphics(void);
void lcd_clear_text(void);
void lcd_write_text(unsigned char character, unsigned char x, unsigned char y);
void lcd_set_pixel(unsigned char x, unsigned char y);
void lcd_clear_pixel(unsigned char x, unsigned char y);
unsigned char lcd_bit_to_byte(unsigned char btb_bit);
void delay_ms(int i);
//void set_bit(unsigned char sb_data, unsigned char sb_bit);
//void clear_bit(unsigned char cb_data, unsigned char cb_bit);
void set_cgram(unsigned char code *ch);
//void new_write_under_picture(unsigned char o_x,unsigned char o_y,char cch[2]);
void STA_RST(void);
//void SYSCLK_Init(void);
void PORT_Init (void);
void UART0_Init (void);
void ADC0_Init (void);
void Timer3_Init (int counts);
void ADC0_ISR (void);
void SYSCLK_Init_AD (void);
void SYSCLK_Init_LCD(void);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -