STM32单片机PVD功能操作流程解析
STM32内部自带PVD功能,用于对MCU供电电压VDD进行监控。通过电
源控制寄存器中的PLS[2:0]位可以用来设定监控电压的阀值,通过对外部电压进行比较
来监控电源。当条件触发,需要系统进入特别保护状态,执行紧急关闭任务:对系统的
一些数据保存起来,同时对外设进行相应的保护操作。
操作流程:
1)、
系统启动后启动PVD,并开启相应的中断。
PWR_PVDLevelConfig(PWR_PVDLevel_2V8); // 设定监控阀值
PWR_PVDCmd(ENABLE); // 使能PVD
EXTI_StrucTInit(
EXTI_InitStructure.EXTI_Line = EXTI_Line16; // PVD连接到中断线16上
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; //使用中断模式
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Raising;//电压低于阀值时产生中断
EXTI_InitStructure.EXTI_LineCmd = ENABLE; // 使能中断线
EXTI_Init( // 初始
EXTI_InitStructure.EXTI_Trigger的赋值可选项:
EXTI_Trigger_Rising---表示电压从高下降到低于设定阀值时产生中断;
EXTI_Trigger_Falling---表示电压从低上升到高于设定阀值时产生中断;
EXTI_Trigger_Rising_Falling---表示电压上升或下降越过设定阀值时都产生中断。
2)、当工作电压低于设定阀值时,将产生PVD中断,在中断程序中进行相应的处理:
void PVD_IRQHandler(void)
{
EXTI_ClearITPendingBit(EXTI_Line16);
…… // 用户添加紧急处理代码处
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
STM32F103-PCA9685控制16路舵机 keil工程 (263个子文件)
Template.uvguix.Administrator 71KB
Template.axf 282KB
Template_sct.Bak 479B
keilkill.bat 399B
stm32f10x_tim.c 107KB
stm32f10x_flash.c 61KB
stm32f10x_rcc.c 50KB
stm32f10x_adc.c 46KB
stm32f10x_i2c.c 45KB
stm32f10x_can.c 44KB
stm32f10x_usart.c 37KB
system_stm32f10x.c 36KB
stm32f10x_fsmc.c 35KB
stm32f10x_spi.c 30KB
stm32f10x_dma.c 29KB
stm32f10x_sdio.c 28KB
stm32f10x_gpio.c 23KB
stm32f10x_dac.c 19KB
usart.c 17KB
core_cm3.c 17KB
stm32f10x_cec.c 11KB
stm32f10x_pwr.c 9KB
stm32f10x_rtc.c 8KB
stm32f10x_bkp.c 8KB
misc.c 7KB
stm32f10x_exti.c 7KB
delay.c 6KB
stm32f10x_wwdg.c 6KB
stm32f10x_dbgmcu.c 5KB
stm32f10x_iwdg.c 5KB
stm32f10x_it.c 4KB
IIC1.c 3KB
stm32f10x_crc.c 3KB
pca9685.c 3KB
main.c 455B
system.c 27B
sys.c 22B
stm32f10x_tim.crf 361KB
main.crf 354KB
esp8266.crf 354KB
ds3232.crf 352KB
test.crf 351KB
iic1.crf 350KB
oled.crf 349KB
usmart.crf 349KB
pca9685.crf 349KB
stm32f10x_can.crf 348KB
exti.crf 347KB
stm32f10x_adc.crf 347KB
stm32f10x_rcc.crf 347KB
stm32f10x_flash.crf 347KB
bsp_usart.crf 346KB
stm32f10x_i2c.crf 345KB
stm32f10x_usart.crf 345KB
stm32f10x_fsmc.crf 345KB
usart.crf 345KB
usmart_str.crf 344KB
bluetooth.crf 344KB
stm32f10x_sdio.crf 344KB
stm32f10x_spi.crf 344KB
iic.crf 343KB
stm32f10x_gpio.crf 343KB
myiic.crf 343KB
stm32f10x_dma.crf 343KB
usmart_config.crf 343KB
dht11.crf 342KB
stm32f10x_dac.crf 341KB
timer.crf 341KB
stm32f10x_cec.crf 341KB
wkup.crf 341KB
system_stm32f10x.crf 341KB
system_stm32f10x_1.crf 341KB
stm32f10x_bkp.crf 341KB
key.crf 341KB
stm32f10x_pwr.crf 340KB
stm32f10x_rtc.crf 340KB
led.crf 340KB
stm32f10x_exti.crf 340KB
common.crf 340KB
system.crf 340KB
sys.crf 340KB
stm32f10x_wwdg.crf 340KB
misc.crf 340KB
wdg.crf 340KB
delay.crf 339KB
stm32f10x_iwdg.crf 339KB
stm32f10x_crc.crf 339KB
pwm.crf 339KB
time.crf 339KB
stm32f10x_it.crf 339KB
pvd.crf 339KB
stm32f10x_dbgmcu.crf 339KB
core_cm3.crf 4KB
esp8266.d 3KB
stm32f10x_dbgmcu.d 3KB
test.d 3KB
usmart_config.d 3KB
stm32f10x_usart.d 3KB
stm32f10x_flash.d 3KB
system_stm32f10x_1.d 3KB
共 263 条
- 1
- 2
- 3
资源评论
y惘然__
- 粉丝: 1
- 资源: 35
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功