DatasheetQ Logo
Electronic component search and free download site. Transistors,MosFET ,Diode,Integrated circuits

TMP05ART-REEL Ver la hoja de datos (PDF) - Analog Devices

Número de pieza
componentes Descripción
Fabricante
TMP05ART-REEL Datasheet PDF : 28 Pages
First Prev 21 22 23 24 25 26 27 28
CONTINUOUSLY CONVERTING APPLICATION
This section provides an example of how to connect one
TMP05 in continuously converting mode to a microchip
PIC16F876 microcontroller. Figure 37 shows how to interface to
the PIC16F876.
TMP05 Program Code Example 2 shows how to communicate
from the microchip device to the TMP05. This code can also be
used with other PICs by simply changing the include file for the
part.
TMP05/TMP06
FIRST TEMP
MEASUREMENT
SECOND TEMP
MEASUREMENT
T0
TIME
PIC16F876
PA.0
TMP05
OUT
VDD
3.3V
CONV/IN
0.1µF
FUNC GND
Figure 37. Typical Daisy-Chain Application Circuit
TMP05 Program Code Example 2
//=============================================================================================
//
// Description : This program reads the temperature from a TMP05 part set up in continuously
// converting mode.
// This code was written for a PIC16F876, but can be easily configured to function with other
// PICs by simply changing the include file for the part.
//
//
Fosc = 4MHz
//
Compiled under CCS C compiler IDE version 3.4
//
PWM output from TMP05 connected to PortA.0 of PIC16F876
//
//============================================================================================
#include <16F876.h>
// Insert header file for the particular PIC being used
#device adc=8
#use delay(clock=4000000)
#fuses NOWDT,XT, PUT, NOPROTECT, BROWNOUT, LVP
//_______________________________Wait for high function_____________________________________
void wait_for_high() {
while(input(PIN_A0)) ;
/* while high, wait for low */
while(!input(PIN_A0));
/* wait for high */
}
//______________________________Wait for low function_______________________________________
void wait_for_low() {
while(input(PIN_A0));
/* wait for high */
}
//_______________________________Main begins here____________________________________________
void main(){
long int high_time,low_time,temp;
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_spi(FALSE);
setup_timer_1 ( T1_INTERNAL | T1_DIV_BY_2);
//Sets up timer to overflow after 131.07ms
Rev. 0 | Page 23 of 28

Share Link: 

datasheetq.com  [ Privacy Policy ]Request Datasheet ] [ Contact Us ]