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.
Bookmarks