转载:https://blog.csdn.net/u014647208/article/details/52574880
暂未进行验证 仅做笔记以备不时之需
实测得这样写:
#include<ioCC2541.h>
#include <string.h>
#include "ioCC254x_bitdef.h"
#include "hal_i2c.h"
#define uint unsigned int
#define uchar unsigned char
void main(void)
{
P0SEL = 0x00;
P1SEL = 0x00;
P2SEL = 0x00;
P0DIR = 0x00;
P1DIR = 0x00;
P2DIR = 0x00;
P0INP = 0x00;
P1INP = 0x00;
P2INP = 0x00;
SLEEPCMD = (SLEEPCMD & ~SLEEPCMD_MODE) | SLEEPCMD_MODE_PM3;
PCON = 1;
while(1);
}
第二种:
#include<ioCC2540.h>
void main(void)
{
P0SEL = 0x00;
P1SEL = 0x00;
P2SEL = 0x00;
P0DIR = 0x00;
P1DIR = 0x00;
P2DIR = 0x00;
P0INP = 0x00;
P1INP = 0x00;
P2INP = 0x00;
// SLEEPCMD = (SLEEPCMD & ~SLEEPCMD_MODE) | SLEEPCMD_MODE_PM3;
SLEEPCMD |= 3; //设置系统睡眠模式
PCON = 0x01; //进入睡眠模式 ,通过中断唤醒
// PCON = 1;
while(1);
}
实验介绍
通过查看芯片手册cc2541的电气特性表,cc2541低功耗(LowPower)有三种状态:PowerMode1(简称:PM1)、PowerMode2(简称:PM2)、PowerMode3(简称:PM3)。
描述:
PM1: 4-μs Wake-up
PM2: Sleep Timer On
PM3: