> 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 > could. 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 www.semiconductors.philips.com Search for I2C hardware and applications notes. ------------ Barry King, KA1NLH Engineering Manager NRG Systems "Measuring the Wind's Energy" Hinesburg, Vermont, USA barry@nrgsystems.com "The witty saying has been deleted due to limited EPROM space"