sbit F0 = 0xD5;
sbit AC = 0xD6; sbit CY = 0xD7;
/*------------------------------------------------ Interrupt Vectors:
Interrupt Address = (Number * 8) + 3
------------------------------------------------*/
#define IE0_VECTOR 0 /* 0x03 External Interrupt 0 */ #define TF0_VECTOR 1 /* 0x0B Timer 0 */
#define IE1_VECTOR 2 /* 0x13 External Interrupt 1 */ #define TF1_VECTOR 3 /* 0x1B Timer 1 */ #define SIO_VECTOR 4 /* 0x23 Serial port */
#define TF2_VECTOR 5 /* 0x2B Timer 2 */
#define EX2_VECTOR 5 /* 0x2B External Interrupt 2 */
#endif
??/********
lcd.c
LCD
***************/
/***********************************************************************************/
/* LCD(HS12864图形点阵液晶KS0108B控制器)底层驱动程序 */ /* */ /* */ /* */ /* */
接: 版
江
天
煌
科 线
见CanycalL 本
技
实LCD.H :业
有
定
义
,
Designer 浙
chx111081@163.com V 限
公
1.0
司
/***********************************************************************************/
#include
#include \
void delay(unsigned int a) //延时 1MS/次 {
unsigned char i;
while(--a!=0) {
for(i=0;i<125;i++) ; }
}
typedef struct typFNT_Char //------字符字模显示数据结构------ {
char Index_Char[1]; char Msk_Char[16];
};
struct typFNT_Char code ASC_16[] = {//-----显示为8*16-----
// MingLiu体
\ \,0x20,0x00,0x00, \ \ \ \ \,0x10,0x20,0x20,0x10,0x0F,0x00, \
\\\\
\ };
typedef struct typFNT_GB16 //------字符字模显示数据结构------ {
char Index_GB16[2]; char Msk_GB16[32];
};
struct typFNT_GB16 code GB_16[] = { // 显示16*16 // 楷体_GB2312 \
0x01,0x00,0x18,0x14,0x12,0x11,0x08,0x0A,0x0C,0x18,0x00,0x00,0x00,0x00,0x00, \
,0x20,0x20,0x20,0x24,0x24,0x1F,0x12,0x12,0x12,0x10,0x10,0x10,0x10,0x00,0x00, \
公
\
里
\
程
\8,0x04,0x02,0x01,0x7F,0x01,0x12,0x10,0x12,0x12,0x1F,0x09,0x09,0x08,0x08,0x00,
\总
\0x1C,0x00,0x00,0x0D,0x11,0x21,0x24,0x28,0x20,0x28,0x32,0x02,0x04,0x00,0x00, \单\4,0x04,0x04,0x04,0x04,0x04,0x04,0x7F,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00, \
价
\0x00,0x00,0x3F,0x00,0x20,0x18,0x07,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00, \元\0x10,0x08,0x04,0x03,0x00,0x00,0x0F,0x10,0x20,0x20,0x20,0x20,0x20,0x1C,0x00, \等\0,0x00,0x00,0x02,0x02,0x06,0x0A,0x22,0x7F,0x01,0x01,0x01,0x00,0x00,0x00,0x00, \
待
\,0xA8,0x28,0x20,0x20,0x20,0x00,0x04,0x02,0x01,0x3F,0x00,0x00,0x02,0x06,0x0A,0x22,0x7F,0x01,0x01,0x01,0x00,0x00, \时\,0x0F,0x04,0x04,0x0F,0x00,0x00,0x01,0x10,0x20,0x3F,0x00,0x00,0x00,0x00,0x00, \
间
\0x00,0x1F,0x00,0x00,0x07,0x02,0x02,0x07,0x00,0x10,0x20,0x1F,0x00,0x00,0x00, \:\x00,0x33,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \年\0x02,0x02,0x02,0x01,0x01,0x01,0x01,0x7F,0x01,0x01,0x01,0x01,0x01,0x01,0x00, \月\0x40,0x20,0x10,0x0C,0x03,0x01,0x00,0x10,0x20,0x1F,0x00,0x00,0x00,0x00,0x00, \
日
\0x00,0x00,0x00,0x0F,0x08,0x04,0x04,0x04,0x08,0x0F,0x00,0x00,0x00,0x00,0x00, \温\,0x18,0x06,0x11,0x10,0x1F,0x11,0x1F,0x09,0x0F,0x08,0x0F,0x08,0x08,0x00,0x00, \度\,0x18,0x06,0x21,0x20,0x22,0x16,0x0A,0x09,0x17,0x30,0x20,0x20,0x20,0x20,0x00, \
℃
\
0x00,0x00,0x00,0x03,0x04,0x08,0x10,0x10,0x10,0x10,0x10,0x08,0x04,0x00,0x00, \
起
\,0x48,0x48,0x00,0xC8,0x48,0x48,0x38,0x00,0x00,0x00,0x00,0x10,0x08,0x07,0x04,0x07,0x09,0x09,0x10,0x13,0x24,0x24,0x24,0x24,0x23,0x20,0x00, \床\x18,0x06,0x11,0x08,0x04,0x02,0x01,0x7F,0x01,0x02,0x04,0x0C,0x08,0x08,0x00, \盼\0x0F,0x09,0x08,0x2F,0x10,0x09,0x05,0x13,0x20,0x10,0x0F,0x00,0x00,0x00,0x00, \
0x08,0x04,0x14,0x3F,0x02,0x09,0x08,0x05,0x06,0x09,0x10,0x20,0x78,0x00,0x00, \
我
\
爱
\0,0x20,0x10,0x28,0x24,0x27,0x1A,0x12,0x1A,0x26,0x20,0x40,0x40,0x40,0x00,0x00, \你\0x00,0x00,0x3F,0x00,0x08,0x06,0x10,0x20,0x3F,0x00,0x02,0x04,0x0C,0x00,0x00, };
/*--------函数列表-------*/ /*-----状态检查-----*/ void Check_Busy(void) {
uchar dat; DI=0;
RW=1; do{
DataPort=0x00; EN=1;
dat=DataPort;
EN=0;
dat=0x80 & dat; //仅当第7位为0时才可操作(判别busy信号) }while(!(dat==0x00)); }
/*-----向LCD发送命令------*/ void Writ_Comd(uchar command) {
Check_Busy(); RW=0;DI=0;
DataPort=command; EN=1; EN=0;
}
/*-----写显示数据------*/ void Write_Dat(uchar dat) {
Check_Busy(); RW=0;DI=1; DataPort=dat; EN=1; EN=0; }
/*------设定行地址(页)--X 0-7------*/ void Set_Line(uchar line) {
line=line & 0x07; // 0<=line<=7 line=line|0xb8; //1011 1xxx Writ_Comd(line); }
/*------设定列地址--Y 0-63-----*/ void Set_Column(uchar column)
{
column=column & 0x3f; // 0= } /*-----设定显示开始行--XX-----*/ void Set_StartLine(uchar startline) //0--63 { startline=startline & 0x07; startline=startline | 0xc0; //1100 0000 Writ_Comd(startline); } /*-----开关显示-----ONOFF=1:ON;ONOFF=0:OFF-----*/ void Set_OnOff(uchar onoff) { onoff=0x3e | onoff; //0011 111x Writ_Comd(onoff); } /*------选择屏幕:screen: 0-全屏,1-左屏,2-右屏-----*/ void Select_Screen(uchar screen)
相关推荐: