完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
void enter_standby_mode(void)
{ //IO口配置 GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;//_IPD输入上拉 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD;//_IPD输入下拉 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;//_IPD输入上拉 GPIO_Init(GPIOA, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin=(GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7|GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD;//_IPD输入下拉 GPIO_Init(GPIOA, &GPIO_InitStructure);//配置A口 其中9 10 为串口,13 14为TMS TCK,共16口 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;//_IPD输入上拉 GPIO_Init(GPIOB, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = (GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7|GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD;//下拉 GPIO_Init(GPIOB, &GPIO_InitStructure);//配置B口 共16口 GPIO_InitStructure.GPIO_Pin = (GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7|GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD;//下拉 GPIO_Init(GPIOC, &GPIO_InitStructure);//端口C的配置,共16个端口 GPIO_InitStructure.GPIO_Pin = (GPIO_Pin_2); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD;//下拉 GPIO_Init(GPIOD, &GPIO_InitStructure);//端口D的配置,1个端口 //一共64端口。ABCD配置了49个端口,VBAT VDD VSS等11个电源端口不用配置 49+11=60 //没有配置的端口有复位端口NRST、boot0端口、PD0(OSC_IN)、PD1(OSC_OUT)等4个端口 RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); //使能PWR外设时钟 PWR_EnterSTANDBYMode(); //进入待命(STANDBY)模式 } 在成功设置低功耗模式后,需要周期性的运行程序,然后进入低功耗,间隔意见时间后,继续运行程序。这时就需要用到RTC时钟来进行对低功耗模式的唤醒。低功耗的stop模式,需要配置EXTI_line17来设置唤醒闹钟,然后才能唤醒stop模式。standby模式不需要设置EXTI_line17,可以直接通过void RTC_IRQHandler(void)中断函数实现唤醒,在配置好RTC的情况下,只需要在主函数加入下列程序即可。 void huanxing(void) { RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR|RCC_APB1Periph_BKP, ENABLE); PWR_BackupAccessCmd(ENABLE); RTC_SetAlarm(RTC_GetCounter()+50); RTC_WaitForLastTask(); RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); PWR_WakeUpPinCmd(ENABLE); PWR_EnterSTANDBYMode(); } 网上找的F103的,你的代码是什么
最佳答案
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
STM32进行DMA数据转运,为什么只有A组最后一位数据被转运到B组去?
1265 浏览 2 评论
1585 浏览 3 评论
1206 浏览 0 评论
嵌入式开发 Win11安装ST-Link 提示 设备描述符请求失败 怎么处理?
1339 浏览 0 评论
1632 浏览 1 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-8-18 12:47 , Processed in 0.581846 second(s), Total 74, Slave 58 queries .
Powered by 电子发烧友网
© 2015 www.ws-dc.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191