tmp03fruz-reel7 Analog Devices, Inc., tmp03fruz-reel7 Datasheet - Page 12
![no-image](/images/no-image-200.jpg)
tmp03fruz-reel7
Manufacturer Part Number
tmp03fruz-reel7
Description
Serial Digital Output Thermometers
Manufacturer
Analog Devices, Inc.
Datasheet
1.TMP03FRUZ-REEL7.pdf
(16 pages)
TMP03/TMP04
Software for the interface is shown in Listing 1. The program
monitors the TMP04 output, and turns the counters on and off
to measure the duty cycle. The time that the output is high is mea-
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
$MOD51
$TITLE(TMP04 Interface, Using T0 and T1)
$PAGEWIDTH(80)
$DEBUG
$OBJECT
;
;
;
PORT1
;TCON
;TMOD
;TH0
;TH1
;TL0
;TL1
;
;
;
READ_TMP04:
WAIT_LO:
WAIT_HI:
;
;Timer 0 runs while TMP04 output is high
;
WAITTIMER0:
;
;Timer 1 runs while TMP04 output is low
;
WAITTIMER1:
Test of a TMP04 interface to the 8051,
using timer 0 and timer 1 to measure the duty cycle
This program has three steps:
Primary controls
Variable declarations
1. Clear the timer registers, then wait for a low-to-
2. When P1.0 goes high, timer 0 starts. The program
3. When P1.0 goes low, timer 0 stops & timer 1 starts. The
high transition on input P1.0 (which is connected
to the output of the TMP04).
then loops, testing P1.0.
program loops until P1.0 goes low, when timer 1 stops
and the TMP04’s T1 and T2 values are stored in Special
Function registers 8AH through 8DH (TL0 through TH1).
DATA
DATA
DATA
DATA
DATA
DATA
DATA
ORG
MOV
MOV
MOV
MOV
MOV
JB
MOV
MOV
JNB
SETB
JB
CLR
SETB
JNB
CLR
MOV
MOV
RET
END
Listing 1. An 80C51 Software Routine for the TMP04
89H
100H
TH0,A
TH1,A
TL0,A
TL1,A
A,#11H
TMOD,A
PORT1.0,WAIT_HI
PORT1.0,WAITTIMER0
TCON.4
TCON.6
A,#0H
TMOD,A
90H
88H
8CH
8DH
8AH
8BH
A,#00
PORT1.0,WAIT_LO
TCON.4
TCON.6
PORT1.0,WAITTIMER1
sured by Timer 0, and the time that the output is low is measured
by Timer 1. When the routine finishes, the results are available
in Special Function Registers (SFRs) 08AH through 08DH.
; counters
;
;
;
;get ready to start timer0
;wait for output to go high
;stop timer 1
;get ready to disable timers
;SFR register for port 1
;timer control
;timer mode
;timer 0 hi byte
;timer 1 hi byte
;timer 0 lo byte
;timer 1 low byte
;arbitrary start
;clear the
;wait for TMP04 output to go low
;start timer 0
;shut off timer 0
;start timer 1
first