EasyManuals Logo

Texas Instruments MSP430 User Manual

Texas Instruments MSP430
413 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #342 background imageLoading...
Page #342 background image
342
One Wire (OW) Interfacing DS18B20 Temperature Sensor
One Wire (OW) or single wire communication is different from other more common and conventional
communication platforms like SPI or I2C in terms of data exchange behavior. OW communication is
also not very much popular compared to SPI, UART (RS232), I2C, RS485, etc. From device to device,
the way of exchanging data varies but what’s common is the fact that all devices that use this
communication method use a sort of time-slotting mechanism. Ones and zeros are defined by high
pulse time over a fixed period. This trick is widely used in infrared remote controllers. One major
advantage of OW communication is the fact that no special or dedicated hardware block is needed to
implement it. All that is typically needed is a digital I/O pin. A timer can be used for tracking time-slots
but it is optional. External interrupts can also be optionally used alongside the timer. DS18B20 one
wire digital temperature sensor from Dallas semiconductor uses this communication protocol.
Code Example
one_wire.h
#include <msp430.h>
#include "delay.h"
#define DS18B20_DIR P2DIR
#define DS18B20_OUT_PORT P2OUT
#define DS18B20_IN_PORT P2IN
#define DS18B20_PIN BIT0
#define DS18B20_OUTPUT() do{DS18B20_DIR |= DS18B20_PIN;}while(0)
#define DS18B20_INPUT() do{DS18B20_DIR &= ~DS18B20_PIN;}while(0)
#define DS18B20_IN() (DS18B20_IN_PORT & DS18B20_PIN)
#define DS18B20_OUT_LOW() do{DS18B20_OUT_PORT &= ~DS18B20_PIN;}while(0)
#define DS18B20_OUT_HIGH() do{DS18B20_OUT_PORT |= DS18B20_PIN;}while(0)
#define TRUE 1
#define FALSE 0

Table of Contents

Other manuals for Texas Instruments MSP430

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments MSP430 and is the answer not in the manual?

Texas Instruments MSP430 Specifications

General IconGeneral
BrandTexas Instruments
ModelMSP430
CategoryMicrocontrollers
LanguageEnglish

Related product manuals