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

📄 t6963c.h

📁 avr单片机的12864Lcd程序
💻 H
字号:
// T6963c.h
//

#ifndef _T6963C_H
#define _T6963C_H

#include "includes.h"



typedef  unsigned char  uchar;	
typedef  unsigned int   uint;	
typedef  unsigned char  bool;

uchar gCurRow;        // 当前行
uchar gCurCol;	      // 当前列

#define BIT(n)  (0x01 << (n))   // 0x01 向左移 n 位

#define STX			0x02
#define ETX			0x03
#define EOT			0x04
#define ENQ			0x05
#define BS			0x08
#define CR			0x0D
#define LF			0x0A
#define DLE			0x10
#define ETB			0x17
#define SPACE		0x20
#define COMMA		0x2C



// #define HIGH		1
// #define LOW		0

// T6963C 端口定义
//#define LCMDW		PORTA		// 数据口
//#define LCMCW		1           // 命令口

#define LCM_WIDTH			128
#define LCM_HEIGHT		    64

// T6963C 命令定义
#define LC_CUR_POS	0x21		// 光标位置设置
#define LC_CGR_POS	0x22		// CGRAM偏置地址设置
#define LC_ADD_POS	0x24		// 地址指针位置
#define LC_TXT_STP	0x40		// 文本区首址
#define LC_TXT_WID	0x41		// 文本区宽度
#define LC_GRH_STP	0x42		// 图形区首址
#define LC_GRH_WID	0x43		// 图形区宽度
#define LC_MOD_OR	0x80		// 显示方式:逻辑“或”
#define LC_MOD_XOR	0x81		// 显示方式:逻辑“异或”
#define LC_MOD_AND	0x82		// 显示方式:逻辑“与”
#define LC_MOD_TCH	0x83		// 显示方式:文本特征
#define LC_DIS_SW	0x90		// 显示开关:D0=1/0:光标闪烁启用/禁用;
                                // D1=1/0:光标显示启用/禁用;
                                // D2=1/0:文本显示启用/禁用;
                                // D3=1/0:图形显示启用/禁用;
#define LC_CUR_SHP	0xA0		// 光标形状选择:0xA0-0xA7表示光标占的行数
#define LC_AUT_WR	0xB0		// 自动写设置
#define LC_AUT_RD	0xB1		// 自动读设置
#define LC_AUT_OVR	0xB2		// 自动读/写结束
#define LC_INC_WR	0xC0		// 数据一次写,地址加1
#define LC_INC_RD	0xC1		// 数据一次读,地址加1
#define LC_DEC_WR	0xC2		// 数据一次写,地址减1
#define LC_DEC_RD	0xC3		// 数据一次读,地址减1
#define LC_NOC_WR	0xC4		// 数据一次写,地址不变
#define LC_NOC_RD	0xC5		// 数据一次读,地址不变
#define LC_SCN_RD	0xE0		// 屏读
#define LC_SCN_CP	0xE8		// 屏拷贝
#define LC_BIT_OP	0xF0		// 位操作:D0-D2:定义D0-D7位;D3:1置位;0:清除


#define    WR  0 // PORTB0    // 低电平有效   
#define    RD  1 // PORTB1    // 低电平有效 
#define    CD  2 // PORTB2    // 高电平命令,低电平数据



extern uchar fnGetRow(void);  // 取得当前行

extern uchar fnGetCol(void);  // 取得当前列

uchar fnST(void);      // 得到当前状态

uchar fnST01(void);		// 状态位STA1,STA0判断(读写指令和读写数据)

uchar fnST2(void);		// 状态位ST2判断(数据自动读状态)

uchar fnST3(void);		// 状态位ST3判断(数据自动写状态)

uchar fnST6(void);		// 状态位ST6判断(屏读/屏拷贝状态)

// Command Write 2 Parameter
uchar fnCW2P(uchar uCmd,uchar uPar1,uchar uPar2);	// 写双参数的指令

// Command Write 1 Parameter
uchar fnCW1P(uchar uCmd,uchar uPar1);	            // 写单参数的指令

// Command Write 0 Parameter
extern uchar fnCW0P(uchar uCmd);	                     	// 写无参数的指令

// Auto Write Data
uchar fnDWD(uchar uData);		// 写数据

// Write Command
uchar fnCWD(uchar uData);		// 写命令

// Read Data
uchar fnDRD(void);				// 读数据
extern void fnSetPos(uchar urow, uchar ucol);

// 设置当前显示行、列
extern void cursor(uchar uRow, uchar uCol);

// 清屏
extern void cls(void);

// LCM 初始化
extern char fnLCMInit(void);
extern void lcd_delay(uint time);
extern uchar dprintf(uchar *ptr);
#endif

⌨️ 快捷键说明

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