PDA

View Full Version : External Serial EEPROM interface



nkwankwe
- 8th August 2010, 05:15
Good day..

I have this smalll problem that I hope u'ld be able to resolve:
I need to key-in a 9 digits topup code,compare it to a pre-stored code n the external eeprom and if a match is made, add credit accordingly. However, i have been trying a simple code to write to and read from the external memory without success. Here is my trail code,have a look:
************************************************** ******************
define OSC 4
ADCON1=6
DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTD
DEFINE LCD_RSBIT 3
DEFINE LCD_EREG PORTD
DEFINE LCD_EBIT 2
DEFINE LCD_BITS 4
DEFINE LCD_LINES 4
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
PAUSE 100
b1 var BYTE
b2 VAR BYTE
b1=10

I2CWRITE PORTC.4,PORTC.3,$A0,1,[b1]
PAUSE 10
I2CREAD PORTC.4,PORTC.3,$A0,1,[B2]
pause 10
lcdout $fe,1,#b2
************************************************** ******************
The LCD just displays 255

Can you help on this regard

rsocor01
- 8th August 2010, 05:31
Check this thread out.

http://www.picbasic.co.uk/forum/showthread.php?t=587&highlight=i2cwrite

Robert