📄 lpc213xdef.h
字号:
PINSEL0 |= (P0_1_EINT0 << P0_1_PINSEL) //选择P0.1为INT0外部中断引脚
PINSEL1 |= (P0_16_EINT0 << P0_16_PINSEL); //选择P0.16也可为INT0外部中断引脚
*/
#define P0_0_GPIO 0//通用数字输入输出管脚
#define P0_0_TXD0 1//UART0的发送器输出
#define P0_0_PWM1 2//脉宽调制器输出1
#define P0_0_PINSEL 2 * P0_0
#define P0_1_GPIO 0//通用数字输入输出管脚
#define P0_1_RXD0 1//UART0的接收器输入
#define P0_1_PWM3 2//脉宽调制器输出3
#define P0_1_EINT0 3//**外部中断0输入
#define P0_1_PINSEL 2 * P0_1
#define P0_2_GPIO 0//通用数字输入输出管脚
#define P0_2_SCL0 1//I2C0时钟输入/输出。开漏输出(符合I2C规范)
#define P0_2_CAP0_0 2//***定时器0的捕获输入通道0
#define P0_2_PINSEL 2 * P0_2
#define P0_3_GPIO 0//通用数字输入输出管脚
#define P0_3_SDA0 1//I2C0数据输入/输出。开漏输出(符合I2C规范)
#define P0_3_MAT0_0 2//**定时器0的匹配输出通道0
#define P0_3_EINT1 3//**外部中断1输入
#define P0_3_PINSEL 2 * P0_3
#define P0_4_GPIO 0//通用数字输入输出管脚
#define P0_4_SCK0 1//SPI0的串行时钟。SPI时钟从主机输出,从机输入
#define P0_4_CAP0_1 2//**定时器0的捕获输入通道1
#define P0_4_AD0_6 3//A/D转换器0输入6。该模拟输入总是连接到相应的管脚
#define P0_4_PINSEL 2 * P0_4
#define P0_5_GPIO 0//通用数字输入输出管脚
#define P0_5_MISO0 1//SPI0主机输入从机输出端。从机到主机的数据传输
#define P0_5_MAT0_1 2//**定时器0的匹配输出通道1
#define P0_5_AD0_7 3//A/D转换器0输入7。该模拟输入总是连接到相应的管脚
#define P0_5_PINSEL 2 * P0_5
#define P0_6_GPIO 0//通用数字输入输出管脚
#define P0_6_MOSI0 1//SPI0主机输出从机输入端。主机到从机的数据传输
#define P0_6_CAP0_2 2//***定时器0的捕获输入通道2
#define P0_6_AD1_0 3//A/D转换器1输入0。该模拟输入总是连接到相应的管脚(仅用于 LPC2138)
#define P0_6_PINSEL 2 * P0_6
#define P0_7_GPIO 0//通用数字输入输出管脚
#define P0_7_SSEL0 1//SPI0从机选择。选择SPI接口用作从机
#define P0_7_PWM2 2//脉宽调制器输出2
#define P0_7_EINT2 3//**外部中断2输入
#define P0_7_PINSEL 2 * P0_7
#define P0_8_GPIO 0//通用数字输入输出管脚
#define P0_8_TXD1 1//UART1的发送器输出
#define P0_8_PWM4 2//脉宽调制器输出4
#define P0_8_AD1_1 3//A/D转换器1输入1。该模拟输入总是连接到相应的管脚(仅用于 LPC2138)
#define P0_8_PINSEL 2 * P0_8
#define P0_9_GPIO 0//通用数字输入输出管脚
#define P0_9_RXD1 1//UART1的接收器输入
#define P0_9_PWM6 2//脉宽调制器输出6
#define P0_9_EINT3 3//***外部中断3输入
#define P0_9_PINSEL 2 * P0_9
#define P0_10_GPIO 0//通用数字输入输出管脚
#define P0_10_RTS1 1//UART1请求发送出端(仅用于LP138)
#define P0_10_CAP1_0 2//定时器1的捕获输入通道0
#define P0_10_AD1_2 3//A/D转换器1输入2。该模拟输入总是连接到相应的管脚(仅用于 LPC2138)
#define P0_10_PINSEL 2 * P0_10
#define P0_11_GPIO 0//通用数字输入输出管脚
#define P0_11_CTS1 1//UART1清除发送入端(仅用于LP138)
#define P0_11_CAP1_1 2//定时器1的捕获输入通道1
#define P0_11_SCL1 3//I2C1时钟输入/输。开漏输出(符合I2C规范)
#define P0_11_PINSEL 2 * P0_11
#define P0_12_GPIO 0//通用数字输入输出管脚
#define P0_12_DSR1 1//UART1数据设置就绪端(仅用于 LPC2138)
#define P0_12_MAT1_0 2//定时器1的匹配输出通道0
#define P0_12_AD1_3 3//A/D转换器1输入3。该模拟输入总是连接到相应的管脚(仅用于 LPC2138)
#define P0_12_PINSEL 2 * P0_12
#define P0_13_GPIO 0//通用数字输入输出管脚
#define P0_13_DTR1 1//UART1数据终端就绪
#define P0_13_MAT1_1 2//定时器1的匹配输出通道1
#define P0_13_AD1_4 3//A/D转换器1输入4。该模拟输入总是连接到相应的管脚(仅用于 LPC2138)
#define P0_13_PINSEL 2 * P0_13
#define P0_14_GPIO 0//通用数字输入输出管脚
#define P0_14_DCD1 1//UART1数据载波检测输入(仅用于 LPC2138)
#define P0_14_EINT1 2//**外部中断1输入
#define P0_14_SDA1 3//I2C1数据输入/输出。开漏输出(符合I2C规范)
#define P0_14_PINSEL 2 * P0_14
#define P0_15_GPIO 0//通用数字输入输出管脚
#define P0_15_RI1 1//UART1铃响指示输入(仅用于 LPC2138)
#define P0_15_EINT2 2//**外部中断2输入
#define P0_14_AD1_5 3//A/D转换器1输入5。该模拟输入总是连接到相应的管脚(仅用于 LPC2138)
#define P0_15_PINSEL 2 * P0_15
#define P0_16_GPIO 0//通用数字输入输出管脚
#define P0_16_EINT0 1//**外部中断0输入
#define P0_16_MAT0_2 2//**定时器0的匹配输出通道2
#define P0_16_CAP0_2 3//***定时器0的捕获输入通道2
#define P0_16_PINSEL 2 * P0_0
#define P0_17_GPIO 0//通用数字输入输出管脚
#define P0_17_CAP1_2 1//**定时器1的捕获输入通道2
#define P0_17_SCK1 2//SPI1的串行时钟。SPI时钟从主机输出,从机输入
#define P0_17_MAT1_2 3//**定时器1的匹配输出通道2
#define P0_17_PINSEL 2 * P0_1
#define P0_18_GPIO 0//通用数字输入输出管脚
#define P0_18_CAP1_3 1//**定时器1的捕获输入通道3
#define P0_18_MISO1 2//SPI1主机输入从机输出端。从机到主机的数据传输
#define P0_18_MAT1_3 3//**定时器1的匹配输出通道3
#define P0_18_PINSEL 2 * P0_2
#define P0_19_GPIO 0//通用数字输入输出管脚
#define P0_19_MAT1_2 1//**定时器1的匹配输出通道2
#define P0_19_MOSI1 2//SPI1主机输出从机输入端。主机到从机的数据传输
#define P0_19_CAP1_2 3//**定时器1的捕获输入通道2
#define P0_19_PINSEL 2 * P0_3
#define P0_20_GPIO 0//通用数字输入输出管脚
#define P0_20_MAT1_3 1//**定时器1的匹配输出通道3
#define P0_20_SSEL1 2//SPI1从机选择。选择SPI接口用作从机
#define P0_20_EINT3 3//***外部中断3输入
#define P0_20_PINSEL 2 * P0_4
#define P0_21_GPIO 0//通用数字输入输出管脚
#define P0_21_PWM5 1//脉宽调制器输出5
#define P0_21_AD1_6 2//A/D转换器1输入6。该模拟输入总是连接到相应的管脚(仅用于 LPC2138)
#define P0_21_CAP1_3 3//**定时器1的捕获输入通道3
#define P0_21_PINSEL 2 * P0_5
#define P0_22_GPIO 0//通用数字输入输出管脚
#define P0_22_AD1_7 1//A/D转换器1输入7。该模拟输入总是连接到相应的管脚(仅用于 LPC2138)
#define P0_22_CAP0_0 2//***定时器0的捕获输入通道0
#define P0_22_MAT0_0 3//**定时器0的匹配输出通道0
#define P0_22_PINSEL 2 * P0_6
#define P0_23_GPIO 0//通用数字输入输出管脚
#define P0_23_PINSEL 2 * P0_7
//#define P0_24_GPIO 0//P0.24 脚未用
//#define P0_24_PINSEL 2 * P0_8
#define P0_25_GPIO 0//通用数字输入输出管脚
#define P0_25_AD0_4 1//A/D转换器0输入4。该模拟输入总是连接到相应的管脚.
#define P0_25_DAC 2//D/A 转换器输出(仅用于 LPC2138)
#define P0_25_PINSEL 2 * P0_9
#define P0_26_GPIO 0//通用数字输入输出管脚
#define P0_26_AD0_5 1//A/D转换器0输入5。该模拟输入总是连接到相应的管脚
#define P0_26_PINSEL 2 * P0_10
#define P0_27_GPIO 0//通用数字输入输出管脚
#define P0_27_AD0_0 1//A/D转换器0输入0。该模拟输入总是连接到相应的管脚
#define P0_27_CAP0_1 2//**定时器0的捕获输入通道1
#define P0_27_MAT0_1 3//**定时器0的捕获输入通道1
#define P0_27_PINSEL 2 * P0_11
#define P0_28_GPIO 0//通用数字输入输出管脚
#define P0_28_AD0_1 1//A/D转换器0输入1。该模拟输入总是连接到相应的管脚
#define P0_28_CAP0_2 2//***定时器0的捕获输入通道2
#define P0_28_MAT0_2 3//**定时器0的匹配输出通道2
#define P0_28_PINSEL 2 * P0_12
#define P0_29_GPIO 0//通用数字输入输出管脚
#define P0_29_AD0_2 1//A/D转换器0输入2。该模拟输入总是连接到相应的管脚
#define P0_29_CAP0_3 2//定时器0的捕获输入通道3
#define P0_29_MAT0_3 3//定时器0的匹配输出通道3
#define P0_29_PINSEL 2 * P0_13
#define P0_30_GPIO 0//通用数字输入输出管脚
#define P0_30_AD0_3 1//A/D转换器0输入3。该模拟输入总是连接到相应的管脚
#define P0_30_EINT3 2//***外部中断3输入
#define P0_30_CAP0_0 3//***定时器0的捕获输入通道0
#define P0_30_PINSEL 2 * P0_14
#define P0_31_GPO 0//通用数字输出管脚(注意:此管脚仅为输出)
#define P0_31_PINSEL 2 * P0_15
#define P0_31_GPO 0//通用数字输出管脚(注意:此管脚仅为输出)
#define P0_31_PINSEL 2 * P0_15
//RSIR
#define RSIR (*((volatile unsigned char *) 0xE01FC180))//
#define POR 0//RSIR.0//POR信号有效时该位置位,并清除RSIR寄存器的其它位
#define EXTR 1//RSIR.1//RESET信号有效时该位置位
#define WDTR 2//RSIR.2//当看门狗定时器溢出和看门狗方式寄存器的WDTRESET位为1时,该位置位。
//该位可被其它任何一个复位源清除。
#define BODR 3//RSIR.3//当3.3V的电源降到低于2.6V时该位置位
//SPI0
//S0SPCR位定义
#define CPHA 3
#define CPOL 4
#define MSTR 5
#define LSBF 6
#define SPIE 7
//S0SPSR位定义
#define SPIF 7
//PCONP
#define PCSPI1 10//该位为1 时,SSP 接口使能。为0 时,SSP 接口被关闭以实现节电。
//WDMOD
#define WDEN 0//
#define WDRESET 1//
#define WDTOF 2//
#define WDINT 3//
/*------------------------------------------------------------------------
结构指针在ARM之应用(情人节版)
------------------------------------------------------------------------*/
typedef volatile unsigned long LPC_REG;// Hardware register definition
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -