Hi I'm using a PICAXE-18X with a external EEPROM (64K it is similar to other EEPROMs supplied by techsupplies. even the pin configs are the same) anyways... I'm recording data (just 1 and 0 for testing purposes) from input 2 and sending it on a I2C protocol every second. the code for writing the data to EEPROM is as follows:
'pin2 = input
'pin0 = record
'pin7 = serial send data to PC
'pin6 = read from mem button
'output 0 = record for tristate (write-protect)
'serout for LCD and PC
'b3 = data to send to PC
record:
low 0
for b0 = 0 to 250 step 1
if pin0 =1 then
let b1 = pin2
i2cslave %00000000, i2cslow8, i2cbyte
serout 7, N2400, (254,128,#b0,"= ", #b1)
serout 7, N2400, (254,192,"Recording... "
writei2c b0, (b1)
pause 990
elseif pin0 = 0 then
high 0
goto main
endif
next b0
'end of record
and my code for reading from EEPROM and send to PC is as follows: (the PIC communicates with the PC fine even all the numbers are fine but the data read from the ROM is always 0)
mem_pc:
if pin7 = 1 then
serout 7, N2400, (254,192, "Press send again"
if pin7 = 1 then
serout 7, N2400, (254,128, "Sending Data"
serout 7, N2400, (254,192, "Do NOT Disconnect"
for b0 = 0 to 249 step 1
''
i2cslave %00000000, i2cslow8, i2cbyte
readi2c b0,(b3)
sertxd (#b0, " ", #b3,13,10)
next b0
Endif
elseif pin7=0 then
goto mem_pc
endif
'end of mem_pc
(the lines may have wrapped, there are no syntax errors present)
one more thing u might want to know is that the address for the EEPROM is 000
thanks
here's the link to a txt file which was captured from Hyper terminal
http://lemonus.googlepages.com/PICtest4.txt
thanks
Edited by - atharvai on 02/04/2007 21:21:10
Edited by - atharvai on 02/04/2007 21:23:30
'pin2 = input
'pin0 = record
'pin7 = serial send data to PC
'pin6 = read from mem button
'output 0 = record for tristate (write-protect)
'serout for LCD and PC
'b3 = data to send to PC
record:
low 0
for b0 = 0 to 250 step 1
if pin0 =1 then
let b1 = pin2
i2cslave %00000000, i2cslow8, i2cbyte
serout 7, N2400, (254,128,#b0,"= ", #b1)
serout 7, N2400, (254,192,"Recording... "
writei2c b0, (b1)
pause 990
elseif pin0 = 0 then
high 0
goto main
endif
next b0
'end of record
and my code for reading from EEPROM and send to PC is as follows: (the PIC communicates with the PC fine even all the numbers are fine but the data read from the ROM is always 0)
mem_pc:
if pin7 = 1 then
serout 7, N2400, (254,192, "Press send again"
if pin7 = 1 then
serout 7, N2400, (254,128, "Sending Data"
serout 7, N2400, (254,192, "Do NOT Disconnect"
for b0 = 0 to 249 step 1
''
i2cslave %00000000, i2cslow8, i2cbyte
readi2c b0,(b3)
sertxd (#b0, " ", #b3,13,10)
next b0
Endif
elseif pin7=0 then
goto mem_pc
endif
'end of mem_pc
(the lines may have wrapped, there are no syntax errors present)
one more thing u might want to know is that the address for the EEPROM is 000
thanks
here's the link to a txt file which was captured from Hyper terminal
http://lemonus.googlepages.com/PICtest4.txt
thanks
Edited by - atharvai on 02/04/2007 21:21:10
Edited by - atharvai on 02/04/2007 21:23:30