Skip to main content
Topic: I2C (Read 2266 times) previous topic - next topic

I2C

I thought this may be of help as I have read through the forum that I2C cannot be used as the main pins are in use
I am using the I2C interface for 1 wire via a ds2482-100  and an I2C LCD display
I am using the Alternate pins RB5 and 6
The clue is you cannot set alternate pins via your program if you use the bootloader
As the bootloader is the first program loaded on the PIC it sets the configuration bits
In the bootloader code  add to    FPOR    & ALTI2C_ON  recompile and upload
or in your programmer  load the bootloader hex code, enable ALTI2C  bit in the programmer configuration    and rewrite the bootloader

There also seems some different suggestions for the I2C Baud rate  value
define I2C_BRG 0x188  gives a 98Khz  clock viewed on my digital scope

Below is the I2C  1 wire  test
please see look for my website homemon for detailed graphs

Find all 1 wire devices
Start
i2c online ack OW
Reset = 1
Aresult 1
Found device 1 FA000800C1634510
Search next
Search Done
Found 1 ow device

Obviously  rewriting the bootloader  is done at your own risk.  you will have to upload your program after

Re: I2C

Reply #1
Thanks for sharing. Is it homemon.co.uk?
Got a question? Please ask in the forum for the fastest answers.