Mikroelektronika MIKROE-350 データシート

ページ / 526
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
Library Routines
- Ow_Reset 
- Ow_Read 
- Ow_Write 
281
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
This variable must be
defined in any project
that is using OneWire
Library:
Description: 
Example : 
dim OW_Bit_Read as
sbit sfr external
OneWire read line.
dim OW_Bit_Read as
sbit at 
PINB.B2
dim OW_Bit_Write as
sbit sfr external
OneWire write line.
dim OW_Bit_Write as
sbit at 
PORTB.B2
dim OW_Bit_Direction
as sbit sfr external
Direction of the OneWire pin.
dim OW_Bit_Direction
as sbit at DDRB.B2