'I2C bus master using PIC16C7X?'
Does anyone have any experience implementing an I2C bus master using a
PIC16C76 (or other similar chip)? I'm trying to do this for a
one-master bus with an 24LC32A EEPROM as the only slave, and only
block-read and block-write required. Microchip's AN554, "Software
Implementation of I2C Bus Master" talks generally but I'm not sure how
to solve this specific problem. What kind of h/w on the PIC will be
used for the bus master -- how much RAM, how many temp variables,
etc.; will one or more real time clocks be needed? Are interrupts
needed? I'd rather run the master in the background if I could.
Many thanks for your time.
Roger L Stevens
The latest PIC'n book, Serial PIC'n, has programs to implement
I2C and EEPROM block read and write. Very little PIC resources are
See their site at http://www.sq-1.com
On Sun, 11 Jul 1999 15:19:16 -0500 "s. rao" <BLUE.WEEG.UIOWA.EDU> shrirao
Get the Internet just the way you want it.
Free software, free e-mail, and free Internet access for a month!
Try Juno Web: dl.http://www.juno.com/dynoget/tagj.
|> Does anyone have any experience implementing an I2C bus master using
> PIC16C76 (or other similar chip)?
Yes, I have this working.
> I'm trying to do this for a
> one-master bus with an 24LC32A EEPROM as the only slave, and only
> block-read and block-write required.
Single master makes it much easier.
> Microchip's AN554, "Software> Implementation of I2C Bus Master" talks
> generally but I'm not sure how
> to solve this specific problem. What kind of h/w on the PIC will be
> used for the bus master
I use the SCL and SDA pins, but I do NOT use the SSP, it is set idle.
My code directly manipulates the TRIS and PORTC registers to control
and monitor the bus pins. You shift the bits out one at a time, i.e.
"bit-bang" the clock and data lines.
The code itself only uses a few bytes of temporary registers. But
you'll probably want a data buffer as large as your largest desired
read / arite block, if you can afford to allocate it. Mine is only
16 bytes, that's all all I could afford, and I usually write only
small blocks at a time.
> will one or more real time clocks be needed?
I think you mean timers? On a 4 MHz PIC, the bus spec is fast
enough that a few NOP cycles are enough to meet set-up and max
frequency specifications for the 400 kHz bus. You'll need to use a
timer to give the 24LC32 time to complete the write cycle after each
write block. I think it takes 10 ms maximum to complete.
> Are interrupts needed? I'd rather run the master in the background if I
You can't on the 16C7x, becuase there is no hardware support for
mastering. You can do an interrupt driven SLAVE using the SSP, but
that is another issue with its own challenges.
My advice is to get AN544 and the Philips I2C specification. Single
master and fixed bus speed makes many of the problems go away. Read
the spec carefully, its really not that complex when you do not need
to accomodate many variations.
Spec is available for download at http://www.semiconductors.philips.com
Search for I2C hardware and applications notes.
Barry King, KA1NLH
NRG Systems "Measuring the Wind's Energy"
Hinesburg, Vermont, USA
"The witty saying has been deleted due to limited EPROM space"
More... (looser matching)
- Last day of these posts
- In 1999
, 2000 only
- New search...