DS2482 I²C 1-Wire® Master driver

by atruntime.com

DS2482 I²C 1-Wire® Master driver

A 1-Wire network consists of a single master and one or more slave devices. The 1-Wire master can be constructed with an IO pin of a microprocessor and manually-generated timing pulses. The DS2482 I²C to 1-Wire bridge alleviates the design engineer from implementing the details of 1-Wire timing. See Figure 1 for a simplified diagram of the DS2482 configuration. Use it, improve it, distribute it!

About this Code Example

#include // Required for SFR defs
#include "OW_Driver.h"

#pragma config FPLLMUL = MUL_20, FPLLIDIV = DIV_2, FPLLODIV = DIV_1, FWDTEN = OFF
#pragma config POSCMOD = XT, FNOSC = PRIPLL, FPBDIV = DIV_1


void main(void)
{
  unsigned char status_reg,configuration_reg,value2,ROM[8],dat[8],temperature;
  unsigned char address=0;


  TRISDbits.TRISD0=0;  
  TRISEbits.TRISE7=0;  
  TRISDbits.TRISD2=0;  

  InitOW();
  status_reg=DeviceReset(0);
  status_reg=DeviceReset(1);
  status_reg=DeviceReset(2);
  status_reg=DeviceReset(3);
  

  configuration_reg=ConfigurationRegister(0,APU|SPU);
  configuration_reg=ConfigurationRegister(1,APU|SPU);
  configuration_reg=ConfigurationRegister(2,APU|SPU);
  configuration_reg=ConfigurationRegister(3,APU|SPU);

    ROM[0]=0x28;
    ROM[1]=0xEF;
    ROM[2]=0xB0;
    ROM[3]=0x70;
    ROM[4]=0x02;
    ROM[5]=0x00;
    ROM[6]=0x00;
    ROM[7]=0xBB;

    while(1) //TESTED! WORKED WELL!! :)
   {
  SkipROM(address);      
  ConvertTemperature(address);  
          MatchROM(address,ROM);      
          temperature= ReadScratchpad(address);                          
}
       
}
  • Current Version: 1.0.0
  • Updated: Jan 31, 2012
  • Downloads: 1668
  • Rating: 0/5 (0 votes cast)
  • Status: Released
    • MPLAB Version:
    • C Compiler: C18,C30,C32
    • Development Tools: ICD-3
    • Supported Devices: PIC18,PIC24,PIC32

Reviews

  • There are no reviews for this Code Example.

    Write your review

    Release History

    DS2482 I²C 1-Wire® Master driver  (current version) January 31, 2012
    first release