barcode reader asp.net web application WDT: THE WATCHDOG TIMER in Software

Encoder Denso QR Bar Code in Software WDT: THE WATCHDOG TIMER

WDT: THE WATCHDOG TIMER
QR Code JIS X 0510 Scanner In None
Using Barcode Control SDK for Software Control to generate, create, read, scan barcode image in Software applications.
QR Creator In None
Using Barcode printer for Software Control to generate, create Denso QR Bar Code image in Software applications.
If you are new to microcontrollers in general and the PIC microcontroller speci cally, you may be unsure as to what the watchdog timer (WDT) offers for your application. A very common informal experiment that is performed is to enable the watchdog timer and see what happens to the application. The result is usually a problem that is dif cult to characterize and nd by looking externally to the PIC microcontroller.
QR Code Reader In None
Using Barcode decoder for Software Control to read, scan read, scan image in Software applications.
Making Denso QR Bar Code In Visual C#.NET
Using Barcode creation for .NET framework Control to generate, create QR Code image in Visual Studio .NET applications.
PIC MICROCONTROLLER APPLICATION BASICS
QR Code Generation In Visual Studio .NET
Using Barcode generation for ASP.NET Control to generate, create QR image in ASP.NET applications.
QR Maker In .NET Framework
Using Barcode maker for VS .NET Control to generate, create Quick Response Code image in Visual Studio .NET applications.
To demonstrate how the watchdog timer works, I created the WDT.asm application, which can be found in the code\WDT folder.
Create QR Code ISO/IEC18004 In VB.NET
Using Barcode creation for .NET Control to generate, create Denso QR Bar Code image in VS .NET applications.
Generating GTIN - 13 In None
Using Barcode printer for Software Control to generate, create European Article Number 13 image in Software applications.
title WDT - Demonstrate PIC MCU Reset using WatchDog Timer ; ; This Code Puts a changing value into PIC microcontroller s PortB ; after loading PortA bits 2 and 3 with the _TO and _PD bits. ; ; The PIC microcontroller should be reset during execution by the ; operation the Watchdog timer, which will cause the _TO and _PD ; Display To Change. ; ; ; Hardware Notes: ; PIC16F84 Running at 4 MHz ; _MCLR is Pulled Up ; All 8 bits of PortB are Pulled up and Connected to LEDs ; PORTA.2 is Pulled up and Connected to a LED for _PD ; PORTA.3 is Pulled up and Connected to a LED for _TO ; ; Myke Predko ; 99.12.23 ; LIST R=DEC INCLUDE p16f84.inc ; Register Usage CBLOCK 0x020 BValue Dlay:2 ENDC
Making Bar Code In None
Using Barcode creator for Software Control to generate, create barcode image in Software applications.
Drawing EAN 128 In None
Using Barcode generation for Software Control to generate, create USS-128 image in Software applications.
Start Registers at End of the Values
Draw Barcode In None
Using Barcode generator for Software Control to generate, create barcode image in Software applications.
Create ECC200 In None
Using Barcode creator for Software Control to generate, create Data Matrix 2d barcode image in Software applications.
PAGE __CONFIG _CP_OFF & _WDT_ON & _XT_OSC & _PWRTE_ON ; Mainline of WDT org 0 nop movlw movwf movwf movlw movwf 0x0FF PORTB BValue 0x00C PORTA
DUN - 14 Creation In None
Using Barcode creator for Software Control to generate, create Case Code image in Software applications.
Barcode Printer In Java
Using Barcode maker for Java Control to generate, create barcode image in Java applications.
SOME BASIC FUNCTIONS
Data Matrix Creator In Visual Basic .NET
Using Barcode generator for VS .NET Control to generate, create Data Matrix 2d barcode image in Visual Studio .NET applications.
Bar Code Reader In Visual Studio .NET
Using Barcode recognizer for .NET Control to read, scan read, scan image in Visual Studio .NET applications.
bsf clrf movlw movwf bcf rrf xorlw andlw movwf Loop: call bcf btfss bsf rlf movwf movwf call movlw movwf goto Delay: clrf clrf decfsz goto decfsz goto return
Draw UPC Code In Visual Basic .NET
Using Barcode creator for .NET Control to generate, create UPC A image in .NET framework applications.
Encode UCC - 12 In Objective-C
Using Barcode creator for iPad Control to generate, create UCC.EAN - 128 image in iPad applications.
STATUS, TRISB ^ 0x013 TRISA ^ STATUS,
GS1 - 13 Creation In VS .NET
Using Barcode drawer for Reporting Service Control to generate, create European Article Number 13 image in Reporting Service applications.
Read Barcode In Java
Using Barcode Control SDK for Java Control to generate, create, read, scan barcode image in Java applications.
RP0 0x080 0x080 RP0
Make All 8 PortB Bits Output Make RA2 and RA3 Outputs
STATUS, w 0x00C 0x00C PORTA
; ; ; ;
Get the Status Bits Invert _PD and _TO Clear the Other Bits Set the LEDs Appropriately ; Loop Here
Delay STATUS, BValue, STATUS, BValue, PORTB BValue Delay 0x0FF PORTB Loop ; Dlay Dlay + 1 Dlay, f $ - 1 Dlay + 1, f $ - 3 Delay 1/5 Seconds ; Turn OFF LEDs C 7 C w ; Change PORTB
The application itself uses a lot of LEDs (and their current-limiting resistors) to provide you with the status of the application, as shown in Fig. 20.7, with the breadboard wiring shown in Fig. 20.8; the bill of materials is listed in Table 20.4. When you rst run the application, note that the two LEDs that were added to RA2 and RA3 are on initially. The application code will start ashing the LEDs in an increasing
PIC MICROCONTROLLER APPLICATION BASICS
16F84
0.1 uF Tantalum Gnd
220 2 PORTA.2 PORTA.3 _TO _PD
10 K
220 8
4 16
_MCLR Osc 1 Osc 2 Vss
4 MHz
PORTB
8 Bits
Figure 20.7 reset.
WDT: monitor PD and TO during watchdog timer
pattern. After a few seconds, the PIC microcontroller will reset and start executing again. Note that when the PIC microcontroller resets, that the LED connected to RA2 (which outputs the value of _PD) is turned off. This indicates that the PIC microcontroller has been reset by a watchdog timer timeout. Also note that the only thing done to enable the watchdog timer in the application code is to just change the _WDT_OFF con guration fuse parameter to _WDT_ON. When the watchdog timer is enabled and the PIC microcontroller powers up, the OPTION register is loaded with all 1s, which means that the prescaler is dedicated to the watchdog
+5 Volt P/S
10 K
Figure 20.8 breadboard.
The watchdog timer reset circuit built on a
0.1 uF
PIC16F84
4 MHz
SOME BASIC FUNCTIONS
TABLE 20.4 PART
BILL OF MATERIALS FOR THE WDT EXPERIMENT DESCRIPTION
PIC microcontroller 4 MHz LED 10-k 220 0.1- F Misc.
PIC16F84-04/P 4-MHz ceramic resonator with internal capacitors 10-LED bargraph display 10 k 220 , 1/4 W , 1/4 W
0.1- F tantalum Breadboard, wiring, +5-V power supply
timer and is running at the maximum value (which is 127). Because the nominal watchdog timer timeout value is 18 ms, the actual timeout interval becomes Watchdog timer timeout nominal timeout interval 18 ms 127 2.286 s prescaler
or the 2.3 seconds that is normally quoted by Microchip as the maximum time for the watchdog timer timeout interval. To prevent the watchdog timer from resetting the PIC microcontroller, you have to add the clrwdt instruction somewhere within the Loop code to reset the watchdog timer (and the prescaler). There should be only one clrwdt instruction in the code (to avoid an application that is running amok to reset the watchdog timer accidentally), and it should be reset after about 50 percent of the nominal timeout interval has executed. This 50 percent value is a rule of thumb to ensure that code added to the application does not cause a problem with the timer and that any variances in the watchdog timer circuit do not cause a short interval that results in an unwanted reset. Proper watchdog timer application speci cation is a bit of a black art. I have not found many applications that really require it the PIC microcontroller is quite a tough little device from the perspective of electrical interference. The only situations where I would look toward enabling it is in a high-noise environment or high potential for ESD discharge, such as a TV set (the yback transformer can generate large EMFs), manufacturing oors, automotive applications, and aviation instruments. Personally, I have never had an application upset by what I would consider to be a noise problem when the PIC microcontroller has been decoupled properly. Having said all this, you are probably not thinking of using the watchdog timer at all for your applications, but there is always the chance that you will accidentally. For many PIC microcontrollers (such as the PIC16F84), enabling the watchdog timer is accomplished by leaving a bit set in the con guration fuses. In these cases, if you forget to put the _WDT_OFF parameter into your __CONFIG statement, then you will be
Copyright © OnBarcode.com . All rights reserved.