STM8L151x IWDG summary

Publisher:学思者Latest update time:2019-11-12 Source: eefocusKeywords:STM8L151x  IWDG  interrupt Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

STM8L watchdog:


(1) Use the internal low-speed clock (LSI): 38K, and set the frequency division of 4-256, so the time can be set to 0.1ms-1724.63ms;


(2) IWDG_KR = 0XCC to enable, IWDG_KR = 0XAA to feed the watchdog, IWDG_KR = 0X55 to allow access to IWDG_PR (prescaler) and IWDG_RLR (watchdog initial value)


void IWDG_Init(void)

{

   CLK_LSICmd(ENABLE);

    while (CLK_GetFlagStatus(CLK_FLAG_LSIRDY) == RESET);

   CLK_BEEPClockConfig(CLK_BEEPCLKSource_LSI);

    CLK_PeripheralClockConfig(CLK_Peripheral_BEEP, ENABLE);

    IWDG_Enable(); //Remember to enable first

   IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);

   IWDG_SetPrescaler(IWDG_Prescaler_256);

   IWDG_SetReload((uint8_t)RELOAD_VALUE); //RELOAD_VALUE = 254 1.724s

   IWDG_ReloadCounter();


}


The programs in the firmware library are:


   IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);

   IWDG_SetPrescaler(IWDG_Prescaler_256);

   IWDG_SetReload((uint8_t)RELOAD_VALUE);

   IWDG_ReloadCounter();


   IWDG_Enable(); //Enable is placed at the end


I tried it this way, and the parameters given previously were useless. As long as it was enabled for about 27ms, it would bite people. There was a timer


Also, please note that many seniors said that dogs cannot be fed during interruptions, but must be fed during the normal program. If the program runs away, it is possible to run into an interruption. . . .

Keywords:STM8L151x  IWDG  interrupt Reference address:STM8L151x IWDG summary

Previous article:stm8 debugging hardware I2C experience
Next article:STM8L independent watchdog IWDG

Recommended ReadingLatest update time:2024-11-16 12:43

STM32 Study Notes---IWDG Independent Watchdog Experiment
After doing the WWDG window watchdog experiment, we continued with the 9th experiment - IWDG independent watchdog experiment. In this experiment, we set the window watchdog IWDG interrupt time to regularly check whether there is an error. In the SysTick_Handler interrupt function, a running light is added to test wheth
[Microcontroller]
STM32 Study Notes---IWDG Independent Watchdog Experiment
PIC32MZ tutorial -- Timer Interrupt
  An interrupt is an internal or external event that requires quick attention from the controller. The PIC32MZ architecture provides a rich interrupt system that can manage up to 190 sources of interrupts. Each interrupt source can have a unique piece of code, called the Interrupt Service Routine (ISR) directly associ
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号