i2c interface with LED driver PCA9532


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: i2c interface with LED driver PCA9532

    I notice the led's are drawn backwards.... It will be kind of tough to get them to light....
    Dave Purola,
    N8NTA
    EN82fn

  2. #2
    Join Date
    Jul 2012
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Re: i2c interface with LED driver PCA9532

    Lol, that's what happens when I draw a schematic in a hurry. Thanks for noticing. The leds are wired correctly on my breadboard though. I just can't get any response from the PCA9532. I've scoped the SDA and SCL pins and I can see the correct clock signal on SCL and various "data" on SDA, so I know that the PIC is outputting something. When I add the optional label argument to the i2cwrite function, the program constantly jumps to the label. Which means that I'm not receiving an acknowledge from the device. I've also tried adding "DEFINE I2C_SLOW 1" to my program because I'm running a 20MHz clock, but it did not help.

  3. #3
    Join Date
    Jul 2012
    Posts
    7


    Did you find this post helpful? Yes | No

    Thumbs down Re: i2c interface with LED driver PCA9532

    Here is my new code and a shot of my oscilloscope to show the output. I can see that I'm not getting an acknowledge, but I do not know why.

    Code:
    '****************************************************************
    '*  Name    : i2c comms test with led driver                    *
    '*  Author  : Cody Finden                                       *
    '*  Version : 1.0                                               *
    '*  Notes   : SOFTWARE FOR A 16F887 TO WRITE TO A LED DRIVER    *
    '*          : OVER THE I2C PROTOCOL                             *
    '****************************************************************
    
    
    #config
     __CONFIG _CONFIG1, _HS_OSC & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _CPD_OFF & _BOR_ON & _IESO_ON & _FCMEN_ON & _LVP_OFF 
     __CONFIG _CONFIG2, _BOR40V & _WRT_OFF 
    #endconfig
    
    
    DEFINE OSC 20
    
    
    ANSEL =     %00000000
    ANSELH =    %00000000
    TRISA =     %00000000
    TRISB =     %00000000
    TRISC =     %00000000
    TRISD =     %00000000
    
    
    SDA         VAR PORTD.3
    SCL         VAR PORTD.2
    led         var portc.5
    addr        var byte
    
    
    INIT:
    PAUSE 400   'let hardware settle
    
    
    'PCA9532 i2c address(7 bits + 1 bit for R/W) 
    'Slave address is 1100(A2)(A1)(A0) + (R/W)
    'In my setup A2 is pulled low, A1 pulled high, A0 pulled low
    addr = %11000100  
    
    
    MAIN:
        
    '    I2CWRITE SDA,SCL,ADDR,[$12,$97,$80,$00,$40,$55,$FA,$00,$00]
    
    
        I2CWRITE SDA,SCL,ADDR,$06,[$00]  'turn off led 0-3
        led = 1     'blink led for feedback
        PAUSE 250
        
        I2CWRITE SDA,SCL,ADDR,$06,[$55]  'turn on led 0-3 
        led = 0
        pause 250
    
    
    goto main
    Name:  100_0087 (Large).JPG
Views: 2713
Size:  121.9 KB

Members who have read this thread : 0

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

Tags for this Thread

Posting Permissions

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