Data Sheet TMP05/TMP06
Rev. C | Page 21 of 28
YE S
NO
NO
YE S
NO
NO
YES
ENTER INTERRUPT
ROUTINE
CHECK IF TIMER 1
IS RUNNING
COPY TIMER 1 VALUES
INTO A REGISTER
RESET TIMER 1
START TIMER 1
IS TEMPSEGMENT
= 1
CALCULATE
TEMP_HIGH0
RESET TIMER 0
TO ZERO
IS TEMPSEGMENT
= 2
IS TEMPSEGMENT
= 3
CALCULATE
TEMP_LOW1
CALCULATE
TEMP_HIGH2
USING TIMER 0
VALUES
INCREMENT
TEMPSEGMENT
EXIT INTERRUPT
ROUTINE
CALCULATE
TEMP_LOW0
USING TIMER 1
VALUES
CALCULATE
TEMP_HIGH1
USING TIMER 0
VALUES
RESET TIMER 0
TO ZERO
YES
03340-037
Figure 36. ADuC812 Interrupt Routine Flowchart
TMP05 Program Code Example 1
//=============================================================================================
// Description : This program reads the temperature from 2 daisy-chained TMP05 parts.
//
// This code runs on any standard 8052 part running at 11.0592MHz.
// If an alternative core frequency is used, the only change required is an
// adjustment of the baud rate timings.
//
// P3.2 = Daisy-chain output connected to INT0.
// P3.7 = Conversion control.
// Timer0 is used in gate mode to measure the high time.
// Timer1 is triggered on a high-to-low transition of INT0 and is used to measure
// the low time.
//=============================================================================================