Professional Documents
Culture Documents
FIGURE 1: WATCHDOG TIMER COUNT VS. TEMPERATURE FOR FOUR PIC16F84A DEVICES
5500
5000
Device1
4500
4000
WDT Count
Device2
3500
Device3
Device4
3000
2500
2000
-20 -10 0 10 20 30 40 50 60
Temperature (C)
POR, BOR,
Wake from SLEEP
NO NO
Clear WDTCOUNT
Load new calibration
and execute DEFAULT YES temps and WDT
CLRWDT = 1 ? counts from EEPROM
NO
YES WDT
Load default temps
Time-out?
and WDT counts
NO
Enable PORTB
Interrupt-on-
change
NO
END
(Return to START
on RESETS)
A 10-minute
YES
key press B
time-out?
NO C
2-minute
YES
key press B Display current low
time-out?
calibration temp and
LO (alternating)
NO C
C
Display current high
calibration temp and UP key Increment
YES
HI (alternate) low calibration
pressed? temperature
C
NO C
YES Increment
UP key
high calibration
pressed? YES Decrement
temperature DOWN key
low calibration
pressed?
NO temperature
C
NO C
YES Decrement
DOWN key
high calibration
pressed? YES Store low calibration
temperature NO SET key
pressed? temperature and
NO WDT count
C
END
(Return to START
TEMP key YES Clear on RESETS)
pressed? DEFAULT flag
NO
Return to B
entry point
CALCULATING TEMPERATURE WITH where y represents the WDT count and x represents
the temperature, we can solve for m to give the num-
WDT COUNT
ber of time-outs per degree Celsius:
The calculation of temperature is based on the two cal- ( y2 y1 )
m = ---------------------
ibrated temperatures and their corresponding WDT ( x2 x1 )
counts. Since the relationship between temperature
and WDT time is nearly a straight line, two points are We can also solve for the temperature for a given WDT
sufficient to determine the slope. Both temperatures time-out value with the equation:
and WDT counts must be determined and stored in ( y 2 y1 )
x 1 = x 2 ---------------------
EEPROM locations. These values remain the same for m
a given device.
As an example, say that 3208 WDT time-outs were
In order to determine the two points on the straight line, counted at 13C, and 3740 were counted at 37C. In
the user will have to find the WDT time values for two this case, the slope is:
known temperatures by executing the calibration pro- 3740 3208
cess. To obtain the most accurate calculation of the m = ------------------------------
37 13
slope, the difference between the two calibration tem- = 22.17
peratures must be at least 20C. For production testing,
multiple units should be tested in parallel, using the For a temperature with 3300 time-outs, we use the
Calibration mode in the source code. higher known temperature and its count as x2 and y2,
and solve for x1 to get:
To calibrate the system, the WDT time-out count was
x 1 = 37 ------------------------------
collected with the device in the precision thermistors at 3740 3300
22.17
two different temperatures (13C and 37C). With the
time-out counts and temperatures at two different = 17.2
points, the temperature between these points can be
which rounds off to 17C.
calculated by simple linear regression.
For the standard equation for a straight line:
y = mx + b
MODES OF OPERATION Display Mode: When the TEMP key is pressed, the
system wakes up and the LEDs show the temperature
The WDT Thermometer has three distinct operating in degrees Centigrade. If the TEMP key is not pressed
modes. again within 5 seconds, the system will return to
SLEEP Mode: This is the default mode the system SLEEP mode.
starts in when power is applied, and when it is not in the It is important to note that the system will not automat-
other modes. There is no display or other sign of ically update the display with temperature changes that
activity. occur while it is in Display mode. To update the display
with the current temperature, it is necessary to press
TEMP again, after the system has returned to SLEEP
mode.
www.microchip.com
The PICmicro family meets the specifications contained in the Microchip Data Sheet.
Microchip believes that its family of PICmicro microcontrollers is one of the most secure products of its kind on the market today,
when used in the intended manner and under normal conditions.
There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowl-
edge, require using the PICmicro microcontroller in a manner outside the operating specifications contained in the data sheet.
The person doing so may be engaged in theft of intellectual property.
Microchip is willing to work with the customer who is concerned about the integrity of their code.
Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as unbreakable.
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of
our product.
If you have any further questions about this matter, please contact the local sales office nearest to you.
01/18/02