Mar
23

OneWire Library

History

The OneWire protocol which in fact needs two wires (data and ground) is fantastic for many reasons: you can have a very long cable (250 feets), you can have multiples of devices on this cable and with a simple code you can poll those devices to get temperature, voltage, switch position, wind speed, etc.


This protocol was developed by Dallas Semiconductor (now Maxim-IC).  Many flavors of devices can be connected to an OneWire port. You can see them at Maxim (http://www.maxim-ic.com/1-Wire.cfm) web site!

OneWire Features

  • Cable can be long
  • Devices take their power from the data line
  • Multiples devices can be used on the same cable
  • Each device has is own ID (48 bits serial number)

Download

Source Code




4 Comments to “OneWire Library”

  • Felipe January 17, 2012 at 9:25 pm

    I don't understand "the mask", the argument to the functions, could you give me an example??, it's the port?
    Input:            mask : Where the device are on the port?
     
    also what's the function of this code?
    //**************************************
    //            D E F I N E
    //**************************************
    // User dependent BEGIN
    #define ONEWIRE       0×01                            // BIT
    #define ONEPIN    (*(volatile unsigned char *)0×36)    // PIN register
    #define ONEDDR    (*(volatile unsigned char *)0×37)    // Data Direction Register
    #define ONEPORT    (*(volatile unsigned char *)0×38)    // PORT
    // User dependent END
    it's the configuration of the pins/port/ddr??, if it's case i don't understand how to setup, thanks for the web site, it's cool!!

  • admin January 17, 2012 at 11:14 pm

    It’s make so many time I wrote this code, I don’t really remember about the mask, it could me the bit port pin for the define you could make #define ONEPN PIND (if you use port D)

    Sylvain

  • Felipe January 18, 2012 at 4:24 pm

    Maybe you have an example of use (project), can you send me in a e-mail??, felipe.paredes@gmail.com, that will be useful for me. thanks for the answer

  • Jean-Claude February 20, 2012 at 10:55 pm

    Hi Sylvain,
    I'm also interested in a simple example code in C using this lib, I also want to read the temperature from a DS18B20.
    Thanks
    jc.dasilva@free.fr

Post comment

Please note

All my source codes were taken from my personal projects.

Everything is for your information only. The C/C++ codes have been written
with ICCAVR. You can find the header and source CRT files by downloading their compiler.

All is for your information and everything is AS IS without any warranty of any kind. No other files are available and I don't make any modification for any body.

Categories

Blogroll

Electronic Links

Tags

AGC Anemometer AVR AVR Bootloader Bootloader Capacitence Capacitor Clock Color Control DCC Debugger Devices Digital driver Function Generator High Gain Microphone Humidity Inductance Inductor Laser LCD LED 3W Library Lightning Detector MegaLoad Meter Moodlight Mood Light MS5534 Nixie OscilloScope projector Rain Fall Sensor rgb RGB LED Scop Sensor SHT75 Temperature Terminal Tipping Bucket Train Modeling Vintage Water Detector