2 wire sensor problem


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2006
    Location
    INDIA
    Posts
    89

    Unhappy 2 wire sensor problem

    I attempt to read ds1621 with pic16f877A, but always reading 00 value;
    Where is mistake ? Please .....

    ' pic16f877a

    DEFINE OSC 4
    INCLUDE "MYLCD.BAS" ' lcd on portb
    CMCON = 7
    ADCON1 = 7

    SCL VAR PORTD.2
    SDA VAR PORTD.3

    ;( A0,A1,A2 = gnd )

    W0 var word
    ds var byte
    Startconvert var byte

    Startconvert = $EE ' Initiates temperature conversion.
    ds = %10100000 ' device address


    start:
    i2cwrite SDA,SCL,ds,$AC,[0] ' Access Config
    pause 100
    i2cwrite SDA,SCL,ds,Startconvert ' Start Conversion
    pause 750
    gosub gettemp
    lcdout $fe,1
    lcdout "Temperature = ",dec2 W0

    pause 800
    goto start



    gettemp:
    i2cread SDA,SCL,ds,$AA,[W0] ' Read last converted temperature value from temperature register.
    W0 = W0 >> 8
    return
    Attached Images Attached Images  
    Last edited by precision; - 2nd April 2007 at 14:04.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by precision View Post
    I attempt to read ds1621 with pic16f877A, but always reading 00 value;
    Where is mistake ? Please .....
    Pullups on SCL/SDA lines?

  3. #3
    Join Date
    Mar 2006
    Location
    INDIA
    Posts
    89


    Did you find this post helpful? Yes | No

    Default

    Yes
    4.7k 1/4 watt resistors pullups from both, scl and sda pin.


    .

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Try getting rid of the W0 >> 8 and see what happens in the LCDout statement. And get rid of the DEC2 in the LCDout... just to see if you get any numbers that make any sense at all.

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    The device address for a DS1621 is %1001xxx0, not %1010xxx0.
    <br>
    DT

Similar Threads

  1. How to drive the Vinculum VDIP1 in UART mode
    By BrianT in forum Code Examples
    Replies: 41
    Last Post: - 23rd May 2013, 12:34
  2. USB-FTDI[UM232R] with PIC16f877a
    By bjox in forum USB
    Replies: 1
    Last Post: - 23rd February 2008, 22:40
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  4. how? 2 wire lcd with pbp?
    By nimonia in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 20th October 2005, 07:41
  5. Help LCD with 2 wire Connect (Idea)
    By jetpr in forum Schematics
    Replies: 10
    Last Post: - 18th August 2005, 06:46

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts