/**********************************************************************
*                       Dallas 1-wire Bus Routines
*
*                    Michael Pearce 26 March 2001
*
* Electronics Workshop, Chemistry Department, University of Canterbury
***********************************************************************
Processors Used: Tested on PIC12 & PIC16 series, may need mods for some
***********************************************************************
Disclaimer:
The following code has been released so that someone may possibly find
something useful in them. The Author and the company he works for takes
no responsibilty for the use of this code or any damage that may be
caused by using part of all of this code.
***********************************************************************
Overview:
In designing automation equipment in instrumentation for chemistry
experiments there was a need for a temperature to digital system that
was simple and quick to deal with.On searching the web I came across the
DALLAS DS1820 Digital Temperature Probe. This uses the DALLAS iButton's
1-wire bus (actually 2 to 3 wire if you count ground and extra power).
This bus allows more than 64 devices to be connected to the same wires,
and can supply a certian amount of phantom power.
I actually started using this bus direct from a PC's serial port and
on the Phillips 8051 series of micro-controllers, of which example code
and hardware schematics were provided... and it actually worked.
I started to use PICs about a year later, and even later had a project that
required the use of the DS1820 temperature probes, so had to sit down
and write a version that would work on the PIC.
I have added CRC checking since, thanks to David Hayward who first used the
C demo code from DALLAS, of which I have since modified to work on the PIC.
For more info about 1-wire and the Temperature probes see the DALLAS
web site at http://www.dalsemi.com/

For examples of how to use these routines see the Heater Project.

Here is a list of the files:

1wire.c
crccheck.c
checksum.c
checksum_v0.c

*************************** 1WIRE.C ********************************
USES: delay.h, delay.c

DESCRIPTION:
Initialises and performs 1-wire bus functions.
Basic functions include reset, read and write.
More complex functions include match rom and read rom.

************************* CRCCHECK.C *******************************
DESCRIPTION:
This was an attempt at a memory space saving CRC checking routine
using the data provided by DALLAS - I haven't got it working yet and
ended up using the fast memory hungry method used in checksum.c cause
I needed to get the project finished in a hurry. I may eventually
finish it of sometime in the future.

************************* CHECKSUM.C *******************************
DESCRIPTION:
This is the memory hungry CRC Check routine, but it works.
This is slightly modified from the code David Hayward used for a PC
version. It has a 256 byte table that allows a fast calculation
of the CRC, and it works.
For an example see the heater project.


************************* CHECKSUM_V0.C *******************************
DESCRIPTION:
This is the original code that David Hayward used on the PC.
It is almost identical to the demo code from DALLAS.
Note: This is here just as an example, it needs the PC drivers for
the 1-wire bus before it will work. For more info see the 1-wire/ibutton
data sheets at http://www.dalsemi.com/

********************************************************************/













