Hallo zuammen,
Ich habe ein kleines Problem mit einem externen Eeprom.
Die Aufgabe: Ich will ein Array aus einem String mit 38 Bytes und dies 500 mal.
Da immer Fehler aufgetreten sind habe ich es auf 10 gekürzt.
CodeBox BascomAVR
Zuerst habe ich mit einem 25LC256 von Microchip experimentiert. Laut Bascom Hilfe können diese eingestzt werden: Lib:FM25c256 Of course you can also use a cheaper normal SPI EEPROM. These are slower and have less write cycles.
Würde mir ja ausreichen. Aber es kam nur Müll beim Auslesen:
Nach langem herumsuchen fand ich auch den Fehler. In dem Datenblatt des Eeproms heißt es:
Page write operations are limited to writing bytes within a single physical page,
regardless of the number of bytes actually being written. Physical page boundaries
start at addresses that are integer multiples of the page buffer size (or ‘page size’)
and, end at addresses that are integer multiples of page size – 1. If a
Page Write command attempts to write across a physical page boundary, the
result is that the data wraps around to the beginning of the current page (overwriting
data previously stored there), instead of being written to the next page as might be
expected. It is therefore necessary for the application software to prevent page write
operations that would attempt to cross a page boundary.
Also wechsel zu Ramtron bzw Heute Cypress Eeprom FM25W256. Dann sieht das Ergebniss so aus:
Immer das erste Feld des Arrays funktioniert nicht, egal ob das Array aus 10 oder 600 Einträgen besteht.
Liegt der Fehler in der fm25c256.lib oder übersehe ich was??
Danke für Eure Hilfe
Jogi
Ich habe ein kleines Problem mit einem externen Eeprom.
Die Aufgabe: Ich will ein Array aus einem String mit 38 Bytes und dies 500 mal.
Da immer Fehler aufgetreten sind habe ich es auf 10 gekürzt.
CodeBox BascomAVR
$regfile = "m1284pdef.dat" $crystal = 14745600 $hwstack = 128 $swstack = 256 $framesize = 256 $baud = 9600 Config Portb.4 = Output Config Portb.7 = Output Config Portb.5 = Output Fram_cs Alias Portb.4 : Const Fram_csp = 4 : Const Fram_csport = Portb Fram_so Alias Pinb.6 : Const Fram_sop = 6 : Const Fram_soport = Pinb Fram_si Alias Portb.5 : Const Fram_sip = 5 : Const Fram_siport = Portb Fram_sck Alias Portb.7 : Const Fram_sckp = 7 : Const Fram_sckport = Portb $eepromsize = &H32000 $lib "fm25c256.lib" Config Com1 = 9600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0 Config Serialin = Buffered , Size = 100 , Bytematch = 13 Open "com1:" For Binary As #1 Enable Interrupts Dim Nc As Eram Word Dim Eramdat(10) As Eram String * 38 Dim Dat2 As String * 38 Dim Dat As String * 3 Dim I As Word Dim A As String * 3 Dim Anf As String * 4 Do Wait 2 For I = 1 To 10 Print #1 , I A = Str(i) Dat2 = A + "abcdefghijklmnopqrstuvwxyz" + A Eramdat(i) = Dat2 Next I Wait 1 For I = 1 To 10 A = Eramdat(i) Print #1 , A Next I Do I = Val(anf) If I <> 0 Then A = Eramdat(i) Print#1 , A Anf = "0" I = 0 End If Loop Loop Serial0charmatch: Input #1 , Anf , Noecho Return
Zuerst habe ich mit einem 25LC256 von Microchip experimentiert. Laut Bascom Hilfe können diese eingestzt werden: Lib:FM25c256 Of course you can also use a cheaper normal SPI EEPROM. These are slower and have less write cycles.
Würde mir ja ausreichen. Aber es kam nur Müll beim Auslesen:
Code:
1
2
3
4
5
6
7
8
9
10
yz2
2abcdefghijklmnopqrstuvijklmnopqrstuvw
yz4
4abcdefghbcdefghij10
5abcdefghijklmnopqrstuvwxyz5
6abcdefghijklmnopqrstuvwxyz6
7abcdefghijklmnopqrsfghijklmnopqrstuvw
8abcdefghijklmnopqrstuvwxyz8
9abcdeefghij19
10abcdefghijklmnopqrstuvwxyz10
Nach langem herumsuchen fand ich auch den Fehler. In dem Datenblatt des Eeproms heißt es:
Page write operations are limited to writing bytes within a single physical page,
regardless of the number of bytes actually being written. Physical page boundaries
start at addresses that are integer multiples of the page buffer size (or ‘page size’)
and, end at addresses that are integer multiples of page size – 1. If a
Page Write command attempts to write across a physical page boundary, the
result is that the data wraps around to the beginning of the current page (overwriting
data previously stored there), instead of being written to the next page as might be
expected. It is therefore necessary for the application software to prevent page write
operations that would attempt to cross a page boundary.
Also wechsel zu Ramtron bzw Heute Cypress Eeprom FM25W256. Dann sieht das Ergebniss so aus:
Code:
1
2
3
4
5
6
7
8
9
10
41841841841841841841841
2abcdefghijklmnopqrstuvwxyz2
3abcdefghijklmnopqrstuvwxyz3
4abcdefghijklmnopqrstuvwxyz4
5abcdefghijklmnopqrstuvwxyz5
6abcdefghijklmnopqrstuvwxyz6
7abcdefghijklmnopqrstuvwxyz7
8abcdefghijklmnopqrstuvwxyz8
9abcdefghijklmnopqrstuvwxyz9
10abcdefghijklmnopqrstuvwxyz10
Immer das erste Feld des Arrays funktioniert nicht, egal ob das Array aus 10 oder 600 Einträgen besteht.
Liegt der Fehler in der fm25c256.lib oder übersehe ich was??
Danke für Eure Hilfe
Jogi