新手入门
- 积分
- 9
- 金钱
- 9
- 注册时间
- 2019-12-9
- 在线时间
- 2 小时
|
自己最近在做STM32的低功耗模式,芯片用的STM32F103C8T6,用的最小系统板。万用表串联在电源的输入端,实际测量的电流值为电路板消耗电流,但是电流值一直为130uA(LED灯已经移除情况下)。
另外,在进入低功耗模式下后接PC13的LED灯一直亮,不知道为什么。
代码如下
void Sys_Standby(void)
{
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
PWR_WakeUpPinCmd(ENABLE);
PWR_EnterSTANDBYMode();
}
void Sys_Enter_Standby(void)
{
RCC_APB2PeriphResetCmd(0X01FC,DISABLE);
Sys_Standby();
}
void IO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6; //自己外接的按键
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
}
int main()
{
IO_Init();
while(1)
{
if(GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_6) == 0)
{
Sys_Enter_Standby();
}
}
}
|
|