Below are: pieces from a program
1)setup and VARs
2)LOG where I write to 24LC256 (5 words at a time) remenber to not over flow the 64 byte buffer!
3)SEND TO PC to read back from 24lc256

hope it helps
**********************
' ReadColorSensors counts the frequency value from the TCS235R
' The data is transmitted in ASCII so it
' is readable in the DEBUG window or Windows Hyperterminal.
' ALSO THE DATA IS ON THE LCD

'hardware

'microChip used 16F873
' 4k ROM
'192 RAM
'256 EEPROM

'EEPROM 24LC256
' 32K x 8 15 Bit address
' 64 byte buffer 5 mS write time i2c=400khz
' %10100000


key0 var byte 'temp var for key debounce
key1 var byte
key2 var byte
key3 var byte

DEFINE OSC 20 'xtal frequency in mhz

DEFINE HSER_RCSTA 90h 'receive enabled
DEFINE HSER_TXSTA 20h 'transmitter enabled
DEFINE HSER_BAUD 9600 'set baud

DEFINE I2C_HOLD 1
DEFINE I2C_SLOW 1

DEFINE LCD_DREG PORTB 'LCD data port
DEFINE LCD_BITS 8 '8 bit mode

DEFINE LCD_RSREG PORTC 'RS port
DEFINE LCD_RSBIT 2 'RS bit

DEFINE LCD_EREG PORTC 'E port
DEFINE LCD_EBIT 0 'E bit

DEFINE LCD_RWREG PORTC 'R/W port
DEFINE LCD_RWBIT 1 'R/W bit

DEFINE LCD_LINES 2 'lines

LCD_rs var portc.1

' DEFINE LCD_COMMANDUS 4000
' DEFINE LCD_DATAUS 100

ADCON1 = 7 'PIC16F87X PORTa ANALOG OFF DIGITAL ON


'osc=hs
'bod=off
'INCLUDE "MODEDEFS.BAS"



light VAR WORD[6] 'value of light sensor of TCS235R 0-5
lightX VAR WORD 'value of light sensor of TCS235R
lighty var word '
DATA_ VAR WORD 'bargraph
j VAR BYTE 'TEMP
i VAR BYTE 'TEMP
voltage VAR word
voltage1 VAR WORD
voltage2 VAR WORD
T VAR word[6] 'temp array


hour var byte ' Define hour variable
dhour var byte ' Define display hour variable
minute var byte ' Define minute variable
second var byte ' Define second variable
ticks var word ' Define pieces of seconds variable 4/61 of a second
update var byte ' Define when to update LCD
log var byte ' Define logging or not
snd var byte ' Define is sending or not
clr var byte ' do a clear?
address var word ' eeprom address 0 to 32k
address2 var word ' eeprom address 0 to 32k used for send
x var byte ' selects which light meter
z var word ' used as 0

'symbol xxxx = portA.5 'not used
symbol Freq = portA.4 'port connected to the frequency output of the TCS235R
symbol upbutton = portA.2
symbol downbutton = portA.3
symbol rightbutton = portA.1
symbol leftbutton = portA.0
symbol scl = portC.3 'used by I2C memory
symbol sda = portC.4 'used by I2C memory
'symbol xxx = portC.5 'not used yet
symbol tx = portC.6
symbol rx = portC.7

*******************************
'*****log?*****

if second=59 then 'every minute only once
if log = 1 then
LCDOUT $FE,$C0,"log" '$FE,$C0=second line
hserout [dec address/10]
for J=0 to 4
i2cwrite SDA, SCL,$a0,address, [light[J]]'send to EEPROM
hserout [" ",dec4 light[J]] LCDOUT $FE,$C0,"Time OverFlow"
endif
endif
call clrlight 'clear array light[j]
endif
****************************
'*****send to PC********

if snd=1 then 'send data from 0 to current address.
if address2 < address then
i2cread SDA, SCL,$a0,address2, [T[0],T[1],T[2],T[3],T[4]] 'get data from EEPROM
hserout [dec address2/10,$09,dec T[0],$09,dec T[1],$09,dec T[2],$09,dec T[3],$09,dec T[4], $0d]
'address,tab,(light,tab)x5,CR
address2=address2 + 10
else
snd=0
LCDOUT $FE,$C0,"done"
hserout ["End",$0d]
endif
endif
goto start
***************************