#include <16F876A.h> #fuses HS,NOWDT,NOPROTECT,NOLVP,PUT #use delay(clock=20000000) #use i2c(master, sda=PIN_C4, scl=PIN_C3, SLOW, FORCE_HW) main() { byte addr_low=0x00; byte addr_hi=0x00; do { i2c_start(); i2c_write(0xA0); // Control code byte binary 1010000 setup to write address (random read mode) i2c_write(addr_hi); // send address i2c_write(addr_low); i2c_start(); i2c_write(0xA1); // control code byte binary 1010001 setup to read data from address specified above output_b( i2c_read(0) ); // read data and output it on port B byte i2c_stop(); addr_low=addr_low+1; // increment address delay_ms(500); // half second delay (let's us see what's going on. . .not sure how much delay we need } while (addr_low<0xFD); }