PDA

View Full Version : Memory 24LC1015



mpardinho
- 25th May 2014, 18:16
i old post sad
"You should use control address $A0 for write and $A1 for read (for lower), while (for upper) $A8 for write and $A9 for read"

If i use $A0 for write and $A1 work block 1 - 0 to $FFFF
If i use $A8 for write and $A9 not work block 2

need A2 pin tied high?



INCLUDE "modedefs.bas"
Include "AllDigital.pbp"

'-------------------------------------------------------------------------------

#CONFIG
__CONFIG _CONFIG1, _FOSC_INTOSC & _IESO_OFF & _WDTE_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_ON
__CONFIG _CONFIG2, _PLLEN_OFF
#ENDCONFIG

'-------------------------------------------------------------------------------

@ errorlevel -202
@ errorlevel -306

'-------------------------------------------------------------------------------

DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h
DEFINE HSER_BAUD 9600
DEFINE HSER_CLROERR 1

'-------------------------------------------------------------------------------

I2C_Clock var PORTA.0
I2C_Data var PORTC.1

'-------------------------------------------------------------------------------

B0 var byte
B1 var byte
B2 var byte

I var word
Letra var byte

'---[ Boot ]--------------------------------------------------------------------
Boot:

DEFINE OSC 16

OSCCON = %01111000
' x------- SPLLEN: don't care when _PLLEN_OFF in config fuse
' -1111--- Internal clock = 16MHz
' -----x-- Unimplemented
' ------00 System Clock Source = Determined by Config Word

'-------------------------------------------------------------------------------

PORTA = 0
PORTC = 0

LATA = 0
LATC = 0

TRISA = %00000110
TRISC = %00100001

PAUSE 100
hSerout [13, "START", 13]
PAUSE 10

'-------------------------------------------------------------------------------
Main:

Letra = 0
For i = 0 To 15
Letra = 65 + I
I2CWRITE I2C_Data, I2C_Clock, $A8, I, [Letra]
PAUSE 5

hSerout [Letra]
Next i

Teste:

hSerout [13, "----------", 13]

For i = 0 To 15
I2Cread I2C_Data, I2C_Clock, $A9, I, [Letra]
pause 5

hSerout [Letra]
Next i

hSerout [13]
'Goto Teste
END

'-------------------------------------------------------------------------------

Demon
- 28th May 2014, 04:08
I don't see pin A2 used?

Are you missing DEFINES for USART?

What PIC are you using?

Have you tried an I2C sample program first?

Robert

EarlyBird2
- 28th May 2014, 18:11
Yes A2 on the eeprom has to be tied high

EarlyBird2
- 28th May 2014, 18:40
I can not find datasheet for 24LC1015 did you mean 24LC1025?