Datasheet

ONEWIRE LIBRARY
The OneWire library provides routines for communication via the Dallas OneWire
protocol, e.g. with DS18x20 digital thermometer. OneWire is a Master/Slave proto-
col, and all communication cabling required is a single wire. OneWire enabled
devices should have open collector drivers (with single pull-up resistor) on the
shared data line.
Slave devices on the OneWire bus can even get their power supply from data line.
For detailed schematic see device datasheet.
Some basic characteristics of this protocol are:
- single master system,
- low cost,
- low transfer rates (up to 16 kbps),
- fairly long distances (up to 300 meters),
- small data transfer packages.
Each OneWire device has also a unique 64-bit registration number (8-bit device
type, 48-bit serial number and 8-bit CRC), so multiple slaves can co-exist on the
same bus.
Note: Oscillator frequency Fosc needs to be at least 8MHz in order to use the rou-
tines with Dallas digital thermometers.
External dependencies of OneWire Library
347
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6
The following variables must be
defined in all projects using
Manchester Code Library:
Description: Example:
extern sfr sbit OW_Bit_Read;
OneWire read line.
sbit OW_Bit_Read
at PINB.B2;
extern sfr sbit
OW_Bit_Write;
OneWire write line.
sbit OW_Bit_Write
at PORTB.B2;
extern sfr sbit
OW_Bit_Direction;
Direction of the
OneWire pin.
sbit
OW_Bit_Direction
at DDRB.B2;