how to get PCF8574 and PIC16F876A work together


Results 1 to 4 of 4

Threaded View

  1. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    before i read datasheet, can you modify your code as this
    Code:
    DEFINE OSC 10 
    ADCON1=7 
    
    SCL    VAR PORTA.1 ' 4k7 pull-up
    SDA    VAR PORTA.0 ' 4k7 pull-up
    Cont   VAR BYTE
    Cont = %01000000
    
    start:
    
    I2CWRITE SDA,SCL,Cont,[%11111111] 'leds ON
    PAUSE 5000
    
    I2CWRITE SDA,SCL,Cont,[%00000000] 'leds off
    pause 5000
    
    goto start
    • 1. I remove I2C_SLOW define... not sure you need it.

      2. i remove TRISA define. SDA is suppose to be bidirectionnal (if you read/write from external device), but you assign PORTA.0 (SDA) as an input so, when you trying to write to external, it's not sure that it will work as you request...

      3. I add specific Variable for the control byte. It refer to the PBP book and this thread http://www.picbasic.co.uk/forum/show...hlight=I2CREAD

      4. Also, be sure you didn't swap SCL & SDA pins too. If it doesn't work, some registers might be initialize... let me know, i'll take a look to datasheet.
    Last edited by mister_e; - 14th December 2004 at 00:55.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. troubles using more than one PCF8574
    By maus in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 28th July 2007, 19:37

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