Hi everybody,
I am attempting to interface a PIC16F887 with a PCA9532 LED driver. I've read the PCA9532 datasheet http://www.nxp.com/documents/data_sheet/PCA9532.pdf and I am trying to follow the "Programming Example" on page 14. I am new to the i2c protocol and having problems receiving any response from the PCA9532. I have attached the programming example page and my test code. I will post my schematic shortly.
Any help would be greatly appreciated. Thank you very much!
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
addr = $c0 'PCA9532 i2c address
MAIN:
I2CWRITE SDA,SCL,ADDR,[$12,$97,$80,$00,$40,$55,$FA,$00,$00]
led = 1 'blink led for feedback
PAUSE 250
led = 0
pause 250
goto main
Bookmarks