?? lcd_portconfig.h
字號:
//note:如果您使用C語言編寫LCD的底層接口程序的話,這里的定義才會有用
// this file for MCU I/O port or the orther`s hardware config
// for LCD Display
#ifndef __LCD_PORTCONFIG_H__
#define __LCD_PORTCONFIG_H__
#include "LPC22XX.h"
//#include "intrins.h" //包含此頭文件可直接操作內核的寄存器以及一些定義好的宏
/*
#define LCD_Ctrl_GPIO() PINSEL1 &= ~(0x0fff0000)
#define LCD_Ctrl_Out() IODIR0 |= (LCD_CS+LCD_RE+LCD_A0+LCD_RW+LCD_EP)
#define LCD_Ctrl_Set(n) IOSET0 = n
#define LCD_Ctrl_Clr(n) IOCLR0 = n
#define LCD_CS (0x01<<24)
#define LCD_CS_SET() IOSET0 = LCD_CS
#define LCD_CS_CLR() IOCLR0 = LCD_CS
#define LCD_RE (0x01<<25)
#define LCD_RE_SET() IOSET0 = LCD_RE
#define LCD_RE_CLR() IOCLR0 = LCD_RE
#define LCD_A0 (0x01<<27)
#define LCD_A0_SET() IOSET0 = LCD_A0
#define LCD_A0_CLR() IOCLR0 = LCD_A0
#define LCD_RW (0x01<<28)
#define LCD_RW_SET() IOSET0 = LCD_RW
#define LCD_RW_CLR() IOCLR0 = LCD_RW
#define LCD_EP (0x01<<29)
#define LCD_EP_SET() IOSET0 = LCD_EP
#define LCD_EP_CLR() IOCLR0 = LCD_EP
#define LCD_Data_GPIO() PINSEL1 &= ~(0x0000ffff)
#define LCD_Data_Out() IODIR0 |= (0xff<<16)
#define LCD_Data_In() IODIR0 &= ~(0xff<<16)
#define LCD_Data_BUS_Clr() IOCLR0 = (0xff<<16)
#define LCD_Data_BUS_Set(n) IOSET0 = (n<<16)
#define LCD_Data_Read() ((IOPIN0&(0xff<<16))>>16)
#define LCD_Data_BUS_Byte 2
//定義8位的數據線占用端口的哪些位置,0: Port0~Port7
// 1: Port8~Port15
// 2: Port16~Port23
// 3: Port24~Port31 */
#define LCD_DAT_W (*((volatile unsigned char *)0x82600000))
#define LCD_DAT_R (*((volatile unsigned char *)0x82600000))
#define LCD_COM_W (*((volatile unsigned char *)0x82400000))
#define LCD_COM_R (*((volatile unsigned char *)0x82400000))
/*
#define LCD_DAT_W (*((volatile unsigned char *)0x82080001))
#define LCD_DAT_R (*((volatile unsigned char *)0x82080001))
#define LCD_COM_W (*((volatile unsigned char *)0x82080000))
#define LCD_COM_R (*((volatile unsigned char *)0x82080000))
*/
#define LCD_RE (0x01<<24)
#define LCD_RE_SET() IOSET1 = LCD_RE
#define LCD_RE_CLR() IOCLR1 = LCD_RE
#define LCD_Ctrl_GPIO() IODIR1 |= LCD_RE; IOSET1 = LCD_RE;
//========================================================================
// 函數: void LCD_DataWrite(unsigned int Data)
// 描述: 寫一個字(16bit)的顯示數據至LCD中的顯示緩沖RAM當中
// 參數: Data 寫入的數據
// 返回: 無
// 備注: 無
// 版本:
// 2007/03/15 First version
//========================================================================
#define LCD_DataWrite(nW) LCD_DAT_W = (unsigned char)(nW>>8);\
LCD_DAT_W = (unsigned char)nW
//========================================================================
// 函數: void LCD_RegWrite(unsigned char Addr,unsigned int Command)
// 描述: 寫一個字節的數據至LCD中的控制寄存器當中
// 參數: Addr 要寫入的寄存器的地址,低八位有效(byte)
// Command 寫入的數據
// 返回: 無
// 備注:
// 版本:
// 2007/03/15 First version
//========================================================================
#define LCD_RegWrite(n) LCD_COM_W = 0x00;\
LCD_COM_W = n
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -