⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hzmmi._h

📁 atmel的atmega128外扩ram对液晶的驱动调试程序
💻 _H
字号:
#include <iom128.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#ifndef __hzmmi_h
#define __hzmmi_h



#define UBRR0L    (*(volatile unsigned char *)0x29)
#define UCSR0B    (*(volatile unsigned char *)0x2A)
#define UCSR0A    (*(volatile unsigned char *)0x2B)
#define UDR0      (*(volatile unsigned char *)0x2C)
#define UBRR0H    (*(volatile unsigned char *)0x90)
#define UCSR0C    (*(volatile unsigned char *)0x95)
#define UBRR1H    (*(volatile unsigned char *)0x98)
#define UBRR1L    (*(volatile unsigned char *)0x99)
#define UCSR1B    (*(volatile unsigned char *)0x9A)
#define UCSR1A    (*(volatile unsigned char *)0x9B)
#define UDR1      (*(volatile unsigned char *)0x9C)
#define UCSR1C    (*(volatile unsigned char *)0x9D)


//typedef unsigned char byte;
typedef char byte;
typedef unsigned short word;
typedef unsigned long dword;
#define TRUE 1
#define FALSE 0

#define ON      ((char)1)
#define OFF     ((char)0)
//控制数据口定义

//端口D定义
#define LCD_CE   (0x20)    //LCD使能
#define LCD_ID	 (0x40)  //LCD命令数据口
#define LCD_RST  (0x80)     //LCD复位

#define LCD_BUSY_S0 (0x01)      //判LCD忙S0位
#define LCD_BUSY_S1 (0x02)      //判LCD忙S1位
#define LCD_BUSY_S2 (0x04)      //判LCD数据自动读忙位
#define LCD_BUSY_S3   (0x08)      //判LCD数据自动写忙位

//端口E定义
#define RUN_LAMP  (0x04)

//端口G定义
#define EL_ON  (0x10)     //LCD复位

#define KEY_NULL  0
#define KEY_UP    1
#define KEY_LEFT  2
#define KEY_RIGHT 3
#define KEY_DOWN  4
#define KEY_SET   5
#define KEY_QUIT  6
#define KEY_ATTN  7
#define KEY_RST24 8
#define KEY_NOUSE 9

#define LCD_BUSY (0x80)

#define MASTER		  1
#define SLAVE         0
#define CMD_XFER      1
#define CMD_NULL      0
#define CMD_RESYNC    0x5a
#define CMD_ACKSYNC   7
#define EOM           0
#define SLAVE_A       0x41
#define SLAVE_B       0x42
#define DIS_LEN       0x20                     //液晶显示宽度BYTE
#define START_ADDRESS 0x000                  //液晶图形显示起始地址偏移量
#define MMI_VER           1                       //版本号

typedef union {
	dword l;
	struct {
	unsigned char a0;
	unsigned char a1;
	unsigned char a2;
	unsigned char a3;
	}bytes;
}LIB_ADDR;

typedef struct{
       	 const char  *str;
}CSTR;
		
//二维表元素定义
typedef struct{
       	 const char  *AscCode;         //代码项
         const char  *HzTable;         //代码对应的汉化翻译
}DaiMa;
		
#ifdef __main__
#include "hzmmitab18.h"

word ms_count;
word mstimer1,mstimer2;
word mstimer3;
byte poll_com;
word com_i;
byte com_c_key;
byte has_key;
byte soft_dog;
byte ctl_data;
byte nv_update,nv_down_ab;
LIB_ADDR lib_addr;
byte CPU_ID;
byte disp_buffer1[128];           //缓冲区
byte disp_buffer[128];            //显示缓冲区
word commu_end;
byte commu_buf[MAX_COM_BLOCK];


//手形光标定义
const byte menucursor[32]=
{  
0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x80, 
0x03, 0xfe, 0x3c, 0x01, 0x24, 0x7e, 0x24, 0x04, 
0x24, 0x78, 0x24, 0x08, 0x24, 0x78, 0x3f, 0x10, 
0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 
};
/*zw
//手形光标定义
const byte menucursor[32]=
{  
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x01, 
0xc0, 0x7f, 0x3c, 0x80, 0x24, 0x7e, 0x24, 0x20, 
0x24, 0x1e, 0x24, 0x10, 0x24, 0x1e, 0xfc, 0x08, 
0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 
};
zw*/
//天线光标定义
const byte GPScursor[16]=
{
0x02, 0x90, 0x88, 0xc4, 0x40, 0x70, 0x9c, 0x80, 0x80 
};

const DaiMa *SetTable;
const DaiMa *AnalogTable;
const DaiMa *KeyTable;
const DaiMa *ReportTable;
const DaiMa *CTL_DOT;
const CSTR *CTL_DOT_CPU;

#else
extern word ms_count;
extern word mstimer1,mstimer2;
extern word mstimer3;
extern byte poll_com;
extern word com_i;
extern byte com_c_key;
extern byte has_key;
extern byte soft_dog;
extern byte ctl_data;
extern byte nv_update,nv_down_ab;
extern LIB_ADDR lib_addr;
extern byte CPU_ID;
extern word commu_end;
extern byte commu_buf[];
extern byte disp_buffer[];
extern byte disp_buffer1[];
extern word comm_timer;
extern const byte menucursor[];
extern const byte GPScursor[];
extern const DaiMa *SetTable;
extern const DaiMa *AnalogTable;
extern const DaiMa *KeyTable;
extern const DaiMa *ReportTable;
extern const DaiMa *CTL_DOT;
extern const CSTR *CTL_DOT_CPU;
#endif

#define wait_spi() while(1)asm("sbis 0x0e,7")
#define watchdog() PORTB|=WDG,PORTB&=~WDG

#endif
	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -