OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 5999|回复: 4

窗口看门狗

[复制链接]

1

主题

3

帖子

0

精华

新手上路

积分
28
金钱
28
注册时间
2013-4-9
在线时间
0 小时
发表于 2013-4-16 21:05:02 | 显示全部楼层 |阅读模式
void WWDG_IRQHandler(void)
{
// Update WWDG counter
WWDG_SetCounter(0x7F);  //?±?????????ó,?°???????·???ú?ú????
// Clear EWI flag */
WWDG_ClearFlag();  //?????á?°????????±ê????
// Toggle GPIO_Led pin 7 */
LED1=!LED1;
}

原子哥,我在学习的时候遇到这么一个问题,我用的是mini板的板子,用库函数版本的程序下载就不对,而用寄存器版本的下载结果就对,想问下是什么原因呢?我觉得应该是上面的中断服务函数有问题,貌似没有进入这个中断。

正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165540
金钱
165540
注册时间
2010-12-1
在线时间
2117 小时
发表于 2013-4-16 23:05:09 | 显示全部楼层
你编译器什么版本?用我们最新例程试试
我是开源电子网www.openedv.com站长,有关站务问题请与我联系。
正点原子STM32开发板购买店铺http://openedv.taobao.com
正点原子官方微信公众平台,点击这里关注“正点原子”
回复 支持 反对

使用道具 举报

1

主题

3

帖子

0

精华

新手上路

积分
28
金钱
28
注册时间
2013-4-9
在线时间
0 小时
 楼主| 发表于 2013-4-17 08:34:59 | 显示全部楼层
回复【2楼】正点原子:
---------------------------------
4.7A的, 库函数的最新例程有吗?
回复 支持 反对

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165540
金钱
165540
注册时间
2010-12-1
在线时间
2117 小时
发表于 2013-4-17 10:17:22 | 显示全部楼层
我是开源电子网www.openedv.com站长,有关站务问题请与我联系。
正点原子STM32开发板购买店铺http://openedv.taobao.com
正点原子官方微信公众平台,点击这里关注“正点原子”
回复 支持 反对

使用道具 举报

1

主题

3

帖子

0

精华

新手上路

积分
28
金钱
28
注册时间
2013-4-9
在线时间
0 小时
 楼主| 发表于 2013-4-17 16:45:29 | 显示全部楼层
回复【4楼】正点原子:


#include "stm32f10x.h"
//#include "GLCD.h"
#include "eval.h"
#include "SysTickDelay.h"
#include "UART_INTERFACE.h"
#include <stdio.h>


/* rivate typedef -----------------------------------------------------------*/
typedef enum { FAILED = 0, ASSED = !FAILED} TestStatus;

/* rivate define ------------------------------------------------------------*/
/* rivate macro -------------------------------------------------------------*/
#define countof(a)   (sizeof(a) / sizeof(*(a)))

/* rivate variables ---------------------------------------------------------*/
/* rivate function prototypes -----------------------------------------------*/
void RCC_Configuration(void);
void GPIO_Configuration(void);
void NVIC_Configuration(void);




void GPIO_Configuration(void)
{
//GPIO_InitTypeDef GPIO_InitStructure;

/* Configure USART1 Tx (PA.09) as alternate function push-pull */
//GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
//GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
//GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
//GPIO_Init(GPIOA, &GPIO_InitStructure);

/* Configure USART1 Rx (PA.10) as input floating */
//GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
//GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
//GPIO_Init(GPIOA, &GPIO_InitStructure);#ifdef USE_STM3210C_EVAL

/* Initialize LEDs and Key Button mounted on STM3210X-EVAL board */       
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);

//STM_EVAL_PBInit(Button_WAKEUP, Mode_GPIO); //?è??°??üGPIO????
}

//???????????í
void NVIC_Configuration(void)

NVIC_InitTypeDef NVIC_InitStructure;

/* Configure the NVIC reemption riority Bits */  
//NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0); //?è????????·?×é????????????0??,????????4??
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);   //?è????????·?×é????????????2??,????????2??


//?è???ò??±í????????????
#ifdef  VECT_TAB_RAM  
/* Set the Vector Table base location at 0x20000000 */ 
NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);  //?ò??±í????RAM
#else  /* VECT_TAB_FLASH  */
/* Set the Vector Table base location at 0x08000000 */ 
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);   //?ò??±í????FLASH
#endif

//WWDG?°???????·?????è??
NVIC_InitStructure.NVIC_IRQChannel = WWDG_IRQn;    //WWDG????
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;   //????????????1??
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;  //?ì????????0??
NVIC_Init(&NVIC_InitStructure);

}

//?????????±??,?????÷???è?±??
void RCC_Configuration(void)
{
SystemInit();
//RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA 
// |RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC
// |RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE
// |RCC_APB2Periph_ADC1  | RCC_APB2Periph_AFIO 
// |RCC_APB2Periph_SPI1, ENABLE );
// RCC_APB2PeriphClockCmd(RCC_APB2Periph_ALL ,ENABLE );
//RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4 
// |RCC_APB1Periph_USART3|RCC_APB1Periph_TIM2                            
// , ENABLE );
}




//?????ù?????è
void Init_All_Periph(void)
{

RCC_Configuration();

//NVIC_Configuration();

GPIO_Configuration();

//USART1_Configuration();
//USART_Configuration(9600);


}









void Delay(vu32 nCount)
{
for(; nCount != 0; nCount--);
}

/**
  * @brief  Inserts a delay time.
  * @param  nTime: specifies the delay time length, in milliseconds.
  * @retval None
  */
//void Delay(__IO uint32_t nCount)
// {
// for(; nCount != 0; nCount--);
// }



int main(void)
{  
Init_All_Periph();
STM_EVAL_LEDOn(LED1);  //????LED1
STM_EVAL_LEDOff(LED2);  //?¨??LED2

SysTick_Initaize();

delay_ms(300);     //????????????

/* Check if the system has resumed from WWDG reset */
if (RCC_GetFlagStatus(RCC_FLAG_WWDGRST) != RESET)
{ /* WWDGRST flag set */
/* Clear reset flags */
RCC_ClearFlag();
}
else
{ /* WWDGRST flag is not set */

}

NVIC_Configuration();

/* WWDG configuration */
/* Enable WWDG clock */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_WWDG, ENABLE);

/* WWDG clock counter = (PCLK1/4096)/8 = 244 Hz (~4 ms)  */
WWDG_SetPrescaler(WWDG_Prescaler_8);

/* Set Window value to 95 */
WWDG_SetWindowValue(95);

/* Enable WWDG and set counter value to 127, WWDG timeout = ~4 ms * 95 = 380 ms */
WWDG_Enable(127);

/* Clear EWI flag */
WWDG_ClearFlag();

/* Enable EW interrupt */
WWDG_EnableIT();



while(1)
{
STM_EVAL_LEDOff(LED1);  //?¨??LED1
}

}

#ifdef  USE_FULL_ASSERT
/**
  * @brief  Reports the name of the source file and the source line number
  *   where the assert_param error has occurred.
  * @param  file: pointer to the source file name
  * @param  line: assert_param error line source number
  * @retval None
  */
void assert_failed(uint8_t* file, uint32_t line)

  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  /* Infinite loop */
  while (1)
  {
  }
}
#endif



这里面的代码好没头绪哦……我下载试了一下,可以用……
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-7-21 05:37

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表