One reads the use of STM32f030c8t6 microcontroller ADC analog watchdog

STM32f030c8t6 microcontroller ADC analog watchdog use

STM32f030c8t6 microcontroller ADC analog watchdog use

It is not difficult to see from the description provided by the official st manual that the ADC analog watchdog is actually a user can set an upper and lower value of the AD value, and then open the analog watchdog interrupt switch, then it will detect when the IO input conversion AD value is less than The lower limit value or greater than the upper limit value enters the corresponding interrupt function. This is roughly a function implementation process.

STM32f030c8t6 microcontroller ADC analog watchdog use

According to Table 63, it can be seen that the analog watchdog can be set to multi-channel and single-channel mode, that is, one or more channels can be selected to open the analog watchdog detection by setting the corresponding register bits.

So understand the above basic rules, then I have to configure the corresponding function to use the analog watchdog according to the official library file and the instructions.

STM32f030c8t6 microcontroller ADC analog watchdog use

After opening this file, the next step:

STM32f030c8t6 microcontroller ADC analog watchdog use

Look! A detailed description of the use of analog watchdogs has been introduced in this official .c file, as long as you understand the meaning of the English description, the description of the ADC analog watchdog will be completed quickly in conjunction with the datasheet. Simulation watchdog configuration process.

The following is the completed analog watchdog configuration function:

STM32f030c8t6 microcontroller ADC analog watchdog use

Finally, don't forget to add a function that turns on the watchdog interrupt:

ADC_ITConfig(ADC1,ADC_IT_AWD,ENABLE);

The complete configuration process is as follows:

STM32f030c8t6 microcontroller ADC analog watchdog use

voidNVIC_Config(void)

{

NVIC_InitTypeDefNVIC_InitStructure;

NVIC_InitStructure.NVIC_IRQChannelPriority=3;//Priority Priority 1

NVIC_InitStructure.NVIC_IRQChannel=ADC1_IRQn;

NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE;//IRQ channel enable

NVIC_Init(&NVIC_InitStructure);

}

/*

Analog watchdog configuration function

Single channel: 7

*/

voidADC_WatchdogConfig(void)

{

ADC_AnalogWatchdogSingleChannelConfig(ADC1,ADC_AnalogWatchdog_Channel_7);

ADC_AnalogWatchdogThresholdsConfig(ADC1,4050,0);

ADC_AnalogWatchdogCmd(ADC1,ENABLE);

ADC_AnalogWatchdogSingleChannelCmd(ADC1,ENABLE);

}

The above is a brief summary of the use of analog ADC watchdogs. Of course, only some of these features have been used. If anything is wrong, please point out that you are very grateful.

Through the use of watchdogs in this simulation, I understand more clearly the importance of using official resources, and the bell must be tied. This sentence is very suitable for people who are skilled in technology. When I encounter problems, I cannot start or do not know how to use them. When it is time to solve the problem with high efficiency, it is time to think that the manufacturer is the key to solving the problem. There are quite a lot of documentation and tool resources for use, so that you can't find yourself on the Internet. The relevant applications are sometimes distressed and helpless. I would like to share this with my readers!

500 Portable Power Station

500 Portable Power Station,Lifepo4 Portable Power Station,Economical Portable Solar Power Station,Portable Power Station For Camping 500W

Jiangsu Zhitai New Energy Technology Co.,Ltd , https://www.jszhitaienergy.com

Posted on