只测试了待机模式,待机模式实现系统的最低功耗。
原理图如下,一开始全部焊接了,其中S2用来进入待机,S1用来唤醒
测试程序为:
#include "stm32f10x.h"
#include "system_stm32f10x.h"v
oid Sys_Standby(void)
{
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); //使能PWR外设时钟
PWR_WakeUpPinCmd(ENABLE); //使能唤醒管脚功能 PWR_EnterSTANDBYMode(); //进入待机(standby)模式 } //系统进入待机模式 void Sys_Enter_Standby(void) { RCC_APB2PeriphResetCmd(0X01FC,DISABLE); //复位所有IO口,屏蔽这条语句也没有看到什么影响 Sys_Standby(); } void IO_Init(void) { GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6; //PB6上拉输入,对应按键S2 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; GPIO_InitStructure.GPIO_Speed