Hello.
I have PCF8574 connected to PIC18F45K80.
The timings and configs are correct, tried to generate some pulses and frequencies are correct.
Tried just to pull up and down SDA/SCL pins and check result with scope, while having PCF8574 connected - I can see proper pulses on the scope.
However, when I try to I2CWRITE, I see no activity at all on either SDA or SCL pins, and sure does not work. Adding I2C SLOW does not change anything.
Here's my code:
Code:#config CONFIG RETEN = OFF CONFIG INTOSCSEL = HIGH CONFIG SOSCSEL = DIG CONFIG XINST = ON ;Enabled CONFIG FOSC = INTIO1 CONFIG PLLCFG = OFF CONFIG FCMEN = OFF ;Disabled CONFIG PWRTEN = OFF ;Disabled CONFIG BOREN = OFF ;Disabled in hardware, SBOREN disabled CONFIG WDTEN = OFF ;WDT disabled in hardware; SWDTEN bit disabled CONFIG CANMX = PORTB CONFIG MCLRE = OFF #endconfig 'OSCTUNE.6 = 1 ; Enable 4x PLL OSCCON = %01110000 ANCON1=0 'DISABLE ADC D3-D2-D1-D0- ANCON0=0 ADCON0=0 TRISC=%00000000 'set PORTC as output all TRISD=%00000000 'set PORTD as output all TRISB=%00000000 'set PORTB as output all TRISA=%00000000 'set PORTA 2 as input, others as output TRISE=%0000000 'set PORTE as output all define OSC 16 DEFINE I2C_SLOW 1 ADR VAR BYTE ADR=$48 SDA VAR PORTD.3 SCL VAR PORTD.2 'dfe: 'high sda 'pause 1 'low sda 'pause 1 'goto dfe FEDO: I2CWRITE SDA,SCL,ADR,[%11111111] PAUSE 50 I2CWRITE SDA,SCL,ADR,[%00000000] PAUSE 50 GOTO FEDO




Bookmarks