PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Externer Speicher



httpkiller
29.12.2004, 20:10
Ich will mit einem AVR 90S2313 eine grössere Datenmenge speichern. Es sind ca 10-128kb. Ich habe da an einen eeprom gedacht. Hab aber keine ahnung was man da nimmt und wie man den unter bascom ansteuert. Kann mir da jemand ein paar Tipps geben?

Ich will folgendes machen. Ich habe eine Anzeige aus 18x8 LEDs, im Speicher stehen 18 bytewerte die jeweils eine Spalte darstellen. Der Controller liest diese nacheinander ein und stellt diese dar. Danach wartet er eine in dem 19. Byte dargestellten Zeit. Und dann geht alles weiter wie gehabt. Wenn ich nun an den Microcontroller über einen seriellen Port mit dem PC den Befehl schreiben sende soll dieser jeden Bytewert den ich über den PC sende in den Speicher schreiben.

Das programmieren an sich ist nicht das Problem, mich würde nur interessieren wie das mit dem Speicherzugriff klappt. Zur not muss es kein EEPROM sein, es kann auch ein Ram sein. Wobei ein EEPROM natürlich besser währe.

29.12.2004, 20:54
Nimm einfach einen beliebigen Speicher mit seriellem Interface, für die Schnittstellen (I²C, SPI, usw.) sollte es doch in BASCOM schon fertige Routinen geben. Diese dann auf den konkreten Baustein anzupassen sollte kein Problem sein.
Infos zu solchen Bausteinen bekommst du beim Halbleiterdealer deines Vertrauens, wobei ich die Suche von farnell hervorheben möchte, man muss ja nicht dort bestellen.

httpkiller
29.12.2004, 20:59
Wo ist der Unterschied zwischen Flash Eproms und EEProms?

Die seriellen EEPROMS die ich bei Reichelt finde haben alle zu wenig Speicher.

Pascal
30.12.2004, 17:01
du suchst doch einen Speicher mit 10 bis 128 kByte, bei Reichelt gibts I²C-EEPROM mit bis zu 64 kByte, du müsstest ja auch mehrere anschließen können
es gibt aber auch Flash(-EEPROM) mit 512 kByte, bei dem weiß ich aber nicht genau, wie man ihn ansteuert

kann es sein, dass du so etwas ähnliches wie das BlinkenLED(oder so ähnlich) baust?

httpkiller
30.12.2004, 18:17
Ja bau ich, ich hab eine Platine mit Com port anschluss und will noch zusätzlich nen Microcontroller einbauen falls das teil mal frei steht.

Ich hab den Schaltplan mal angehängt. Oben Sind jumper um einen Anschluss an den der Microkontroller rankommt freizugeben.

Ahh da sind se ja du meinst die von Microchip oder?
Ich glaub der EE 24LC64 P ist genau das richige. Und 64k reichen auch da bekomme ich ja über 3000 Bilder drauf.

11.02.2005, 17:37
hast du den plan schon komplettiert? (mit eprom und controller)
würde mich brennend interessieren wie der jetzt ausschaut...

httpkiller
11.02.2005, 20:58
Ne, ich bin noch nicht dazu gekommen.

pebisoft
11.02.2005, 21:00
mit der i2c-steuerung kannst du bis zu 8 eeprom 24c512 (je 64kbyte) anschliessen , also die eeproms haben bis zu 8 adressen. ich habe auf dem steckbrett meines küchenbrettroboters auch 3x 24c512 macht 192 kbyte.
mfg pebisoft

httpkiller
11.02.2005, 21:06
Hast du nen Beispielcode für Bascom dafür?? Man muss ja das Rad nicht zweimal erfinden.

pebisoft
11.02.2005, 21:16
hallo, 2x in bascom, i2c beschreiben und lesen.
je nachdem wie du die adresse am eeprom 24c512 geschaltet hast, kontaktiert hast.
bei mir war es die adresse 160 und 161.
geh das programm in ruhe durch, habe ich auch im forum gefunden.
mfg pebisoft.

i2c-eeprom lesen, ausgabe auf dem lcd :


$regfile = "m16def.dat"
$crystal = 8000000

Enable Interrupts
Config Lcdpin = Pin , Db4 = Portc.3 , Db5 = Portc.2 , Db6 = Portc.1 , Db7 = Portc.0 , Rs = Portc.5 , E = Portc.4
Config Lcd = 16 * 2

Config Portd = Output
Config Sda = Portd.6
Config Scl = Portd.7

Cls
Lcd "EE - Test"
Waitms 500

Declare Sub Write_eeprom(byval Adres As Word , Byval Value As Byte)
Declare Sub Read_eeprom(byval Adres As Word , Value As Byte)

Const Addressw = 160 'slave write address
Const Addressr = 161 'slave read address
Dim I As Word
Dim B1 As Byte , Adres As Word , Value As Byte
Dim Temp As Byte

For I = 15600 To 15700
Call Read_eeprom(i , Value)
Cls
Locate 1 , 1
Lcd I ; "= " ; Value ; " ";
Waitms 500
Next I
End

Sub Write_eeprom(byval Adres Word , Byval Value As Byte)
Temp = High(adres)
I2cstart 'start condition
I2cwbyte Addressw 'slave address
I2cwbyte Temp 'asdress of EEPROM
I2cwbyte Adres
I2cwbyte Value 'value to write
I2cstop 'stop condition
Waitms 10 'wait for 10 milliseconds
End Sub

Sub Read_eeprom(byval Adres Word , Value As Byte)
Temp = High(adres)
I2cstart 'generate start
I2cwbyte Addressw 'slave adsress
I2cwbyte Temp
I2cwbyte Adres 'address of EEPROM

I2cstart 'repeated start
I2cwbyte Addressr 'slave address (read)
I2crbyte Value , Nack 'read byte
I2cstop 'generate stop
End Sub


' when you want to control a chip with a larger memory like the 24c64 it requires an additional byte
' to be sent (consult the datasheet):
' Wires from the I2C address that are not connected will default to 0 in most cases!

' I2cstart 'start condition
' I2cwbyte &B1010_0000 'slave address
' I2cwbyte H 'high address
' I2cwbyte L 'low address
' I2cwbyte Value 'value to write
' I2cstop 'stop condition
' Waitms 10

'End


i2c-eeprom schreiben :

$regfile = "m16def.dat"
$crystal = 8000000

Enable Interrupts
Config Lcdpin = Pin , Db4 = Portc.0 , Db5 = Portc.1 , Db6 = Portc.2 , Db7 = Portc.3 , Rs = Portc.5 , E = Portc.4
Config Lcd = 16 * 2

Config Portd = Output
Config Sda = Portd.6
Config Scl = Portd.7

Cls
Lcd "EE - Test"
Waitms 500

Declare Sub Write_eeprom(byval Adres As Word , Byval Value As Byte)
Declare Sub Read_eeprom(byval Adres As Word , Value As Byte)

Const Addressw = 160 'slave write address
Const Addressr = 161 'slave read address
Dim I As Word
Dim B1 As Byte , Adres As Word , Value As Byte
Dim Temp As Byte

For I = 15600 To 15700
Value = I - 15600
Call Write_eeprom(i , Value)
Next I

End

Sub Write_eeprom(byval Adres Word , Byval Value As Byte)
Temp = High(adres)
I2cstart 'start condition
I2cwbyte Addressw 'slave address
I2cwbyte Temp 'asdress of EEPROM
I2cwbyte Adres
I2cwbyte Value 'value to write
I2cstop 'stop condition
Waitms 10 'wait for 10 milliseconds
End Sub

Sub Read_eeprom(byval Adres Word , Value As Byte)
Temp = High(adres)
I2cstart 'generate start
I2cwbyte Addressw 'slave adsress
I2cwbyte Temp
I2cwbyte Adres 'address of EEPROM

I2cstart 'repeated start
I2cwbyte Addressr 'slave address (read)
I2crbyte Value , Nack 'read byte
I2cstop 'generate stop
End Sub


' I2cstart 'start condition
' I2cwbyte &B1010_0000 'slave address
' I2cwbyte H 'high address
' I2cwbyte L 'low address
' I2cwbyte Value 'value to write
' I2cstop 'stop condition
' Waitms 10

'End

httpkiller
11.02.2005, 21:22
Ich werd morgen mal ein paar Speicher bei Reicheltt bestellen und das ganze mal testen.

pebisoft
11.02.2005, 21:26
du kannst klein mit dem eeprom 24c256 anfangen (32kbyte).
mfg pebisoft

httpkiller
03.03.2005, 22:35
Ich hab mir jetzt den 24C256 geholt, bekomme Ihn abr irgend wie nicht zum laufen, hat jemand da mal ne Beispielschaltung für mich?

pebisoft
04.03.2005, 07:42
hallo, gib ma in der home-seite hier unter suchen den begriff "24c32" oder "24c16" oder "24c256" ein, es gibt viele schöne hinweise in "c" und "bascom" die kann man alle schön addieren.
mfg pebisoft

httpkiller
04.03.2005, 15:34
Der Quelltext ist mir klar, ich komm nur mit der beschaltug und dem i2c bus nicht klar.

Wenn ich an A0 und A1 GND hänge ist die Adresse 160 oder sehe ich das falsch?

Ich hab mal meine Schaltung angehängt, das müsste doch so passen oder?