PDA

View Full Version : 24fc512



Beavis
- 21st February 2005, 23:20
anyone got a 24fc512 to work using i2c? ic2write and read? cant seem to get this to work with this code:


CONTROL = %10100000' CONTROL ADDRESS OF 24FS512
'************************************************* ***********
b1="0"
' FOR B0 = 0 TO 15
I2CWRITE SDA,SCL,control,%0001,$156
PAUSE 100 ' DELAY 10MS AFTER EACH WRITE

' NEXT B0

LOOP:
I2CREAD SDA,SCL,control,%0001,[B1]
LCDOUT $FE,$80, bin16 B1
LCDOUT $FE,$c0, dec B1

pause 2000

LCDOUT, $FE,$1 'CLEAR LCD
PAUSE 1500




GOTO LOOP

mister_e
- 22nd February 2005, 00:59
that's for sure

adress must be a word sized variable
your I2Cwrite statement is not write correctly


try this



addr var word
B0 var byte
control con %10100000
clear

Start:

FOR B0 = 0 TO 15
I2CWRITE SDA,SCL,control,addr,[B0]
PAUSE 10
addr=addr+1
NEXT B0

for addr=0 to 15
I2CREAD SDA,SCL,control,addr,[b0]
LCDOUT $FE,1,"addr = ",dec addr,_
$FE,$C0,"data = ", dec b0
pause 1000
next

Beavis
- 22nd February 2005, 05:27
thanks, dunno how i missed that, thought I tried everything....guess not:)