PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : 24c02 geht... 24c08 nicht... hülfe :)



Spokky
02.04.2006, 10:13
moin, hallo erstmal.
bin zur zeit dabei mich in die avr welt einzuarbeiten. diverse dinge klappen auch ganz gut.

jetzt hab ich ein problem mit nem 24c08 welches ich irgendwie nicht in den griff bekomme.

folgender code läuft mit nem 24c02 einwandfrei.... (naja, bis adresse 255)



$regfile = "m8def.dat"
$crystal = 4000000
Config Lcd = 20 * 2
Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.3 , Rs = Portd.2
Config Portc.0 = Input
Config Portc.1 = Input
Config Portc.2 = Input
Config Portc.3 = Input
Config Portc.4 = Output
Config Portc.5 = Output
Dim A As Byte
Dim B As Integer
Dim D As Integer
Dim Lesen As Byte
Dim C As Integer

Config Sda = Portc.4
Config Scl = Portc.5

Dim Address As Word At &H112
Dim Address_low As Byte At &H112 Overlay
Dim Address_high As Byte At &H113 Overlay
Dim Text As String * 20

Dim Wert As Byte

Dim Ext_eeprom As Byte
Ext_eeprom = 160
Sound Portb.0 , 100 , 100
Cursor Off Noblink
Cls
B = 255
Do

Go:

A = 0
If Pinc.0 = 0 Then
A = A + 1
End If
If Pinc.2 = 0 Then
A = A + 4
End If
If A = 1 Then
C = C + 16
If C <= 0 Then C = 0
If C >= 1008 Then C = 1008
End If
If A > 1 Then
C = C - 16
If C <= 0 Then C = 0
If C >= 1008 Then C = 1008
End If

If B = C Then Goto Go
Cls
B = C
D = B + 15
For Address = B To D
Ext_eeprom = 160
If Address >= 768 Then
Ext_eeprom = Ext_eeprom + 6
Address = Address - 768
Goto Ok
End If
If Address >= 512 Then
Ext_eeprom = Ext_eeprom + 4
Address = Address - 512
Goto Ok
End If
If Address >= 256 Then
Ext_eeprom = Ext_eeprom + 2
Address = Address - 256
Goto Ok
End If
Ok:
I2cstart
I2cwbyte Ext_eeprom
I2cwbyte Address
I2cstart
Ext_eeprom = Ext_eeprom + 1
I2cwbyte Ext_eeprom
I2crbyte Wert , Nack
I2cstop


Lcd Chr(wert) ;
Next
Lowerline
Lcd "Start:" ; B ; " " ; "Ende:" ; D
Waitms 250


Loop

End



habe ein paar werte in die ic´s geschrieben die ich gerne wie eine art menü oder so anzeigen lassen möchte.
bei dem 24c02 klappt das auch. wird brav jeweils 16 byte ausgelesen und ausgegeben.
bei dem 24c08 kommt allerdings nur murks. hin und wieder kommt das was da kommen soll, aber normalerweise sind die buchstaben vertauscht oder fehlen oder sind verschoben.
hinzu kommt noch das das ganze ab adresse 256 irgendwie hängen bleibt. :(

weis jmd was ich falsch mache? :)
benutze die demo von bascom.