☆适用领域:小家电,充电器,重合闸,遥控器,电子烟,燃气报警器,数显表,温控器,记录仪等行业。 ☆ 华大MCU单片机资料分享连接
HC32F003 HC32F005 HC32L110 HC32L136 HC32F030 HC32M140 HC32F146 HC32L150 HC32L156
/****************************************************************************/
/ \file main.c
**
** A detailed description is available at
** @link Sample Group Some description @endlink
**
** - 2017-05-17 1.0 CJ First version for Device Driver Library of Module.
**
******************************************************************************/ /****************************************************************************** - Include files
******************************************************************************/
#include “wdt.h”
#include “lpm.h”
#include “gpio.h” /****************************************************************************** - Local pre-processor symbols/macros (’#define’)
******************************************************************************/
/****************************************************************************** - Global variable definitions (declared in header file with ‘extern’)
******************************************************************************/
/****************************************************************************** - Local type definitions (‘typedef’)
******************************************************************************/
/****************************************************************************** - Local function prototypes (‘static’)
******************************************************************************/
/****************************************************************************** - Local variable definitions (‘static’) *
******************************************************************************/
/****************************************************************************** - Local pre-processor symbols/macros (’#define’)
******************************************************************************/
#define T1_PORT (0)
#define T1_PIN (3)
/***************************************************************************** - Function implementation - global (‘extern’) and local (‘static’)
****************************************************************************/
/
** \brief Main function of project
**
** \return uint32_t return value, if needed
**
** This sample
**
******************************************************************************/
uint8_t u32CountWdt;
uint8_t Data=0xff;
uint8_t cnt=0; static void WdtCallback(void)
{
// comment following to demonstrate the hardware watchdog reset
Data = ~Data;
Gpio_SetIO(T1_PORT,T1_PIN,Data);
u32CountWdt++;
}
int32_t main(void)
{
stc_wdt_config_t stcWdt_Config;
stc_lpm_config_t stcLpmCfg; DDL_ZERO_STRUCT(stcWdt_Config);DDL_ZERO_STRUCT(stcLpmCfg);stcLpmCfg.enSLEEPDEEP = SlpDpDisable;//SlpDpEnable;stcLpmCfg.enSLEEPONEXIT = SlpExtEnable;Gpio_InitIO(T1_PORT,T1_PIN,GpioDirOut);Gpio_SetIO(T1_PORT,T1_PIN,0);Gpio_InitIO(3,3,GpioDirIn);stcWdt_Config.u8LoadValue = 0x0b;//3.2sstcWdt_Config.enResetEnable = WINT_EN;//WRESET_EN;////stcWdt_Config.pfnWdtIrqCb = WdtCallback;Clk_SetPeripheralGate(ClkPeripheralWdt,TRUE);//Wdt_Init(&stcWdt_Config);Wdt_Start();Gpio_SetIO(T1_PORT,T1_PIN,1);- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
#if 0
while(1 == Gpio_GetIO(3,3));//注意:此处如果用户测试深度休眠模式,此处不能屏蔽
Lpm_Config(&stcLpmCfg);
Lpm_GotoLpmMode();
#endif
while (1)
{
//cnt = Wdt_ReadWdtValue();
//Wdt_Feed();//测试喂狗功能时,放开屏蔽
作者:虹芯侠客1 来源:CSDN 原文:https://blog.csdn.net/jetson024/article/details/84619088 版权声明:本文为博主原创**,转载请附上博文链接!
|