如何在PEI阶段enable disablee WDT

#define ()   __asm__ __volatile__ (&wdr&)
#define (value)
#define ()
#define    0
#define    1
#define    2
#define    3
#define    4
#define    5
#define    6
#define    7
#define    8
#define    9
#include &&
This header file declares the interface to some inline macros handling the watchdog timer present in many AVR devices. In order to prevent the watchdog timer configuration from being accidentally altered by a crashing application, a special timed sequence is required in order to change it. The macros within this header file handle the required sequence automatically before changing any value. Interrupts will be disabled during the manipulation.
NoteDepending on the fuse configuration of the particular device, further restrictions might apply, in particular it might be disallowed to turn off the watchdog timer.
Note that for newer devices (ATmega88 and newer, effectively any AVR that has the option to also generate interrupts), the watchdog timer remains active even after a system reset (except a power-on condition), using the fastest prescaler value (approximately 15 ms). It is therefore required to turn off the watchdog early during program startup, the datasheet recommends a sequence like the following:
#include &&
#include &&
mcusr_mirror __attribute__ ((section (&.noinit&)));
void get_mcusr(void) \
__attribute__((naked)) \
__attribute__((section(&.init3&)));
void get_mcusr(void)
mcusr_mirror = MCUSR;
MCUSR = 0;
Saving the value of MCUSR in mcusr_mirror is only needed if the application later wants to examine the reset source, but in particular, clearing the watchdog reset flag before disabling the watchdog is required, according to the datasheet.
#define wdt_disable
Value:__asm__ __volatile__ (
&in __tmp_reg__, __SREG__& &\n\t& \
&cli& &\n\t& \
&out %0, %1& &\n\t& \
&out %0, __zero_reg__& &\n\t& \
&out __SREG__,__tmp_reg__& &\n\t& \
: &I& (_SFR_IO_ADDR(_WD_CONTROL_REG)), \
&r& (()((_WD_CHANGE_BIT) | (WDE))) \
unsigned char uint8_tDefinition: stdint.h:80
#define _BV(bit)Definition: sfr_defs.h:208
Disable the watchdog timer, if possible. This attempts to turn off the Enable bit in the watchdog control register. See the datasheet for details.
#define wdt_enable
Value:__asm__ __volatile__ (
&in __tmp_reg__,__SREG__& &\n\t&
&cli& &\n\t&
&wdr& &\n\t&
&out %0,%1& &\n\t&
&out __SREG__,__tmp_reg__& &\n\t&
&out %0,%2& \
: &I& (_SFR_IO_ADDR(_WD_CONTROL_REG)), \
&r& (()((_WD_CHANGE_BIT) | (WDE))),
&r& (() ((value & 0x08 ? _WD_PS3_MASK : 0x00) | \
(WDE) | (value & 0x07)) ) \
unsigned char uint8_tDefinition: stdint.h:80
#define _BV(bit)Definition: sfr_defs.h:208
Enable the watchdog timer, configuring it for expiry after timeout (which is a combination of the WDP0 through WDP2 bits to write into the WDTCR For those devices that have a WDTCSR register, it uses the combination of the WDP0 through WDP3 bits).
See also the symbolic constants WDTO_15MS et al.
#define wdt_reset
   __asm__ __volatile__ (&wdr&)
Reset the watchdog timer. When the watchdog timer is enabled, a call to this instruction is required before the timer expires, otherwise a watchdog-initiated device reset will occur.
#define WDTO_120MS   3
See WDT0_15MS
#define WDTO_15MS   0
Symbolic constants for the watchdog timeout. Since the watchdog timer is based on a free-running RC oscillator, the times are approximate only and apply to a supply voltage of 5 V. At lower supply voltages, the times will increase. For older devices, the times will be as large as three times when operating at Vcc = 3 V, while the newer devices (e. g. ATmega128, ATmega8) only experience a negligible change.
Possible timeout values are: 15 ms, 30 ms, 60 ms, 120 ms, 250 ms, 500 ms, 1 s, 2 s. (Some devices also allow for 4 s and 8 s.) Symbolic constants are formed by the prefix WDTO_, followed by the time.
Example that would select a watchdog timer expiry of approximately 500 ms: ();
#define WDTO_1S   6
See WDT0_15MS
#define WDTO_250MS   4
See WDT0_15MS
#define WDTO_2S   7
See WDT0_15MS
#define WDTO_30MS   1
See WDT0_15MS
#define WDTO_4S   8
See WDT0_15MS Note: This is only available on the ATtiny2313, ATtiny24, ATtiny44, ATtiny84, ATtiny84A, ATtiny25, ATtiny45, ATtiny85, ATtiny261, ATtiny461, ATtiny861, ATmega48, ATmega88, ATmega168, ATmega48P, ATmega88P, ATmega168P, ATmega328P, ATmega164P, ATmega324P, ATmega644P, ATmega644, ATmega640, ATmega1280, ATmega1281, ATmega2560, ATmega2561, ATmega8HVA, ATmega16HVA, ATmega32HVB, ATmega406, ATmega1284P, AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, AT90PWM216, AT90PWM316, AT90PWM81, AT90PWM161, AT90USB82, AT90USB162, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, ATtiny48, ATtiny88.
#define WDTO_500MS   5
See WDT0_15MS
#define WDTO_60MS   2
#define WDTO_8S   9
See WDT0_15MS Note: This is only available on the ATtiny2313, ATtiny24, ATtiny44, ATtiny84, ATtiny84A, ATtiny25, ATtiny45, ATtiny85, ATtiny261, ATtiny461, ATtiny861, ATmega48, ATmega48A, ATmega48PA, ATmega88, ATmega168, ATmega48P, ATmega88P, ATmega168P, ATmega328P, ATmega164P, ATmega324P, ATmega644P, ATmega644, ATmega640, ATmega1280, ATmega1281, ATmega2560, ATmega2561, ATmega8HVA, ATmega16HVA, ATmega32HVB, ATmega406, ATmega1284P, ATmega2564RFR2, ATmega256RFR2, ATmega1284RFR2, ATmega128RFR2, ATmega644RFR2, ATmega64RFR2 AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, AT90PWM216, AT90PWM316, AT90PWM81, AT90PWM161, AT90USB82, AT90USB162, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, ATtiny48, ATtiny88, ATxmega16a4u, ATxmega32a4u, ATxmega16c4, ATxmega32c4, ATxmega128c3, ATxmega192c3, ATxmega256c3.
Automatically generated by Doxygen 1.8.7 on Tue Aug 12 2014.急急急,请教各位大侠~~AVR单片机看门狗在AVRstudio中怎么用啊~WDTON 编不编程什么区别啊?_百度知道
急急急,请教各位大侠~~AVR单片机看门狗在AVRstudio中怎么用啊~WDTON 编不编程什么区别啊?
程序上都是先wdt_enable(WDTO2);再在中断喂狗wdt_reset()看到有人说一个是软狗 一个是硬狗~有多大的区别啊?在STUDIO中怎么关闭看门狗呢~wdt_disable();可以吗~
在软件中关闭和在熔丝位配置时候关闭,说是等级不一样,在熔丝位配置不配置看门狗,在软件里面打开称为软狗AVR单片机的看门狗在熔丝位直接配置打开称为硬狗,但是我在具体应用中觉得区别不大。至于关闭看门狗同样有两种方法
其他类似问题
为您推荐:
您可能关注的推广
avr单片机的相关知识
其他1条回答
有可能会导致启动不了。这个是我的经验这个如果选择,你的开机参数设置太多的话
那常用看门狗
采用什么方法呢?直接用软狗吗?
我们一般都用软件狗。
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁Feature phone&的production release 版本上存在(1)死机无法抓取得memory dump或是(2)用JTAG分析问题时watchdog timeout了,&可以关闭watchdog去debug 问题,关闭方法如下:
11A before关闭&watchdog方法是将WDT_Enable()这个函数中的参数变为kal_FALSE。如下
Application_Initialize() (init\src\init.c) like this:
#ifdef __PRODUCTION_RELEASE__
#ifdef __MULTI_BOOT__
&& if ( system_boot_mode!=FACTORY_BOOT )
#endif& /* __MULTI_BOOT__ */
&&&& // WDT_Enable(KAL_TRUE);
&&&&& WDT_Enable(KAL_FALSE);
#endif /* __PRODUCTION_RELEASE__ */
11A after(包括11A)关闭&watchdog方法是将wdt_data.fgEnable
= kal_TRUE&改为&KAL_FALSE。如下
Application_Initialize() (hal\system\init\src\init.c) like this:
#ifdef __PRODUCTION_RELEASE__
#ifdef __MULTI_BOOT__
&& if ( system_boot_mode!=FACTORY_BOOT )
#endif& /* __MULTI_BOOT__ */
&&&&&&&&&//wdt_data.fgEnable=KAL_TRUE;
&&&&&&&& wdt_data.fgEnable=KAL_FALSE;
&&& init_dcl_wdt_handle=DclWDT_Open(DCL_WDT,0);&&&&&&&
&&&&&&&& DclWDT_Control(init_dcl_wdt_handle,WDT_CMD_ENABLE,(DCL_CTRL_DATA_T*)&wdt_data);
&&&&&&&& DclWDT_Close(init_dcl_wdt_handle);&&&&&&&&
#endif /* __PRODUCTION_RELEASE__ */
如果在Application_Initialize() (hal\system\init\src\init.c) 沒有上面所述內容,但是有WDT_SetValue(255)函数,
关闭watch dog 方法为: WDT_SetValue(255);替换为WDT_Enable(KAL_FALSE);
在w12.36&11B起增加了两个feature option ,FORCE_MEMORY_DUMP & FORCE_WATCHDOG_MUTE以加速打开或者关闭watch dog and memory dump。修改project make file中的feature option,&然后remake system即可有效。
版权声明:本文为博主原创文章,未经博主允许不得转载。
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:989989次
积分:22245
积分:22245
排名:第142名
原创:1137篇
转载:551篇
评论:212条
(6)(4)(6)(6)(4)(6)(6)(17)(12)(57)(74)(17)(10)(3)(1)(1)(2)(6)(43)(74)(63)(21)(1)(125)(627)(60)(6)(1)(2)(1)(4)(2)(11)(3)(8)(1)(14)(2)(5)(18)(4)(5)(7)(6)(6)(7)(15)(108)(74)(28)(15)(11)(19)(24)(2)(2)(29)[医][=water deprivation test]禁水试验,禁饮试验
看门狗定时器(Watch Dog Timer);
看门狗定时器;
看门狗计数器
大家都在背:
1. When & how to use watchdog ( WDT ) & constant ramp time for RAMP command?
看门狗 ( WDT ) 、 RAMP指令对固定斜率时间,何时以及如何使用?
来自互联网
2. This paper presents the principle, hardware realization of WDT , which is one of the anti - jamming technique.
介绍了作为 抗干扰 技术之一的 WDT 的原理及软硬件实现方法.
来自互联网
WDT的全称:
未分类的(13)
water deprivation test
禁水试验, 禁饮试验
Watch Dog Timer
监视计时器
Watch Dog Timer (embedded systems)
看狗定时器(嵌入式系统)
Weight Data Transmitter
加权数据发送器
Watchdog Timers
看门狗定时器
Watertown Daily Times
每日倍。特
Weather Decision Technologies
天气决策技术
Web Design Team
网页设计团队
Western (Europe) Daylight Time (GMT+0100)
西方(欧洲)天亮时(GMT + 0100)
Western European Daylight Time [ GMT + 0100]
西欧夏令时间到了(GMT + 0100]
看门狗(WDT)电路主要是实现复位功能.当单片机运行出现死循环时看门狗(WDT)电路可以起保护功能实现复位作用。 AT89S51
- 基于5258个网页
2. 看门狗定时器(Watch Dog Timer)
可编程的看门狗定时器(WDT)(LPC11U00为带窗看门狗WWDT)4×40段LCD驱动(LPC11D14) 12MHz内部RC振荡器可调节到+…
- 基于5223个网页
3. 看门狗定时器
可编程的看门狗定时器(WDT)(LPC11U00为带窗看门狗WWDT)4×40段LCD驱动(LPC11D14) 12MHz内部RC振荡器可调节到+…
- 基于3181个网页
4. 看门狗计数器
内部可编程看门狗计数器(WDT);一个8位计时/数器,8位预分频器,可产生溢出中断。 5层堆栈两个具有上拉电阻(R-Option)脚。
- 基于248个网页
1. 加权数据发送器
WDT Watch Dog Timer 监视计时器WDT Weight Data Transmitter 加权数据发送器WDTR Wide Data Transfer Request 宽数据传送请求.
- 基于18个网页
1. 不使用看门狗时钟
图文不使用看门狗时钟 (WDT Disable)。 Question 17
HT95L、HT95C系列的LCD的亮度如何调整?
在Phone MCU内部 LCD亮度有四段的调整,调整的方式是用程序来.
- 基于2个网页
1. 监视计时器
WDS Write Data Strobe 写数据选通WDT Watch Dog Timer 监视计时器WDT Weight Data Transmitter 加权数据发送器
- 基于38个网页
1. 看护时钟
Watch-Dog Timer WDT 看护时钟 Water content 含水量 Water quality monitoring 水质监测 Water-table 地下水位 Watertight 水密 W-beam guardrail 钢板护栏 Wearing.
- 基于2个网页
WatchDog Timer看门狗 WDT是英语Watchdog Timer的缩写字母。 Watchdog Timer 中文名看门狗。是一个定时器电路, 一般有一个输入,叫喂狗,一个输出到MCU的RST端,MCU正常工作的时候,每隔一段时间输出一个信号到喂狗端,给 WDT 清零,如果超过规定的时间不喂狗,锛堃话阍诔绦蚺芊墒憋級,WDT 定时超过,就会给出一个复位信号到MCU,使MCU复位。 防止MCU死机。 看门狗的作用就是防止程序发生死循环,或者说程序跑飞。 工作原理:在系
本内容来源于
以上内容来自百度百科平台,由百度百科网友创作。
0){var rand = parseInt(Math.random() * (000)+100000);top.location.href='/'+encodeURIComponent(document.getElementById('s').value.trim().replace( / /g, '_'))+'?renovate='+}else{top.location.href='/'+encodeURIComponent(document.getElementById('s').value.trim().replace( / /g, '_'));};}" action="/">
查过的词自动加入生词本
Tip:此功能设置只能在登录状态下生效
需要改进的内容:
单词大小写
其他(请在下面补充描述)
错误描述:
您还可在这里补充说明下 O(∩_∩)O~
方便的话,请您留下一种联系方式,便于问题的解决:

我要回帖

更多关于 execute disable bit 的文章

 

随机推荐