PDA

View Full Version : EEPROM 24lc02b



chip_select
- 14th March 2008, 00:50
Hi to everybody,
I have climbed on on the breadbord the circuit brought in the manual of the picbasic advantage related to the writing of an external eeprom.
The brought code doesn't work. Why?
thanks
chip_select


----------------------------------------------------------------------------


'PIC 16F84A & 24LC02B
'LCD DEVANTECH 16 X 4 SERIAL

include "modedefs.bas"
define osc 4


addr var byte
dati var byte
RD var byte
dpin var porta.0
dclk var porta.1


for addr = 0 to 10
dati = ADDR * 16
i2cwrite dpin,dclk,%10100000,addr,[dati]
pause 10
next addr

pause 1000

serout portb.0,2,[12,1]
PAUSE 400
for addr = 0 to 10
i2cread dpin,dclk,%10100000,addr,[RD]
pause 10
serout portb.0,2,["EEPROM CELL: "]
serout portb.0,2,[#RD]
PAUSE 40
serout portb.0,2,[12,1]
next addr

skimask
- 14th March 2008, 12:51
The brought code doesn't work. Why?
Do you have pullups on SDA and SCL?
Also, use a STOP or END at the very end of your program...

chip_select
- 14th March 2008, 21:11
Hi, I have been used 2 resistances of pull-up by 1k as suggested by the tutorial of the microchip.
I will add "end" at the end of the program.
thanks
chip_select

skimask
- 14th March 2008, 21:45
Hi, I have been used 2 resistances of pull-up by 1k as suggested by the tutorial of the microchip.

1K might be a bit strong in a single chip situation. Try 4.7K and 10K also.

JD123
- 14th March 2008, 21:52
Common issues are not pulling WP lead to Vss (ground), not pulling A0:A2 to ground (but this doesn't apply to 2K chips), crossing clock/data lines and the pull-up resistors. I use 4.7K resistors for less current draw. The code looks clean except for the previously noted lack of END at the end of the program. The second 'Pause 10' (after i2cread) serves no practical purpose, but it won't kill the program.

Is the hardware proven good, as in Mr. Blinky? Is the serial com working okay?

Edit: I see Mr. Skimask (I'm assuming something here) said it first while I was typing... what he said.