|
关于nRF24le1外部引脚唤醒程序,不是唤不醒,就是一直处于唤醒状态
[复制链接]
# include "reg24le1.h"
sbit LED = P0^3;
/*******************************************************************************
/函数名称:PinWakeup()
/函数功能:从引脚唤醒nRF
/输入参数:无
/返回参数:无
********************************************************************************/
void PinWakeup(void)
{
OPMCON = 0x04; //所有唤醒引脚低电平有效
WUOPC0 = 0x01; // P0.0作为唤醒引脚
WUOPC1 = 0x00;
WUCON = 0xF3; //只允许WUOPIRQ唤醒
WUPIN = 1; // Wakeup on pin MISC = 0;
WUF = 0; // Clear any pending interrupts
EA = 1; // global interrupt enable
WUF = 0;
}
void main(void)
{
unsigned int j;
CLKCTRL = ( CLKCTRL | 0x80 ) & ~0x08;; //系统时钟为125KHz
CLKLFCTRL = 0x01;
P0DIR = 0x01; //P0.0为输入
P0CON = 0xD0; //Enable pull up for P0.1
PinWakeup();
while (1)
{
LED = ~LED; //每唤醒一次LED取反
for (j = 0; j<50000; j++);
PWRDWN = 0x04; // enter "pwr_dwn"
}
}
/*******************************************************************************
/函数名称:wuopirq_interrupt()
/函数功能:唤醒中断服务函数
/输入参数:无
/返回参数:无
********************************************************************************/
void wuopirq_interrupt(void) interrupt INTERRUPT_WUOPIRQ
{
}
|
|