PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : EEprom



MAxK
13.05.2006, 23:10
Hi,

ich habe in einem Programm

folgenden Eintrag:
$eeprom....dann kommen die Daten....data

BASCOM erstellt ja beim Kompilieren eine eep.-Datei. Muss ich diese dann noch in den µC (ATmega16) "laden" oder geschieht das beim Flashen?

Gruß

Ratber
14.05.2006, 00:02
Das hängt davon ab was du bei den Optionen eingetragen hast.

Optionen->Programmer
Dann Karteireiter "Programmer"

Wenn der Haken bei "Upload Code and Data" gesetzt ist dann wird alles übertragen.

MAxK
21.05.2006, 00:11
Hi,

also der Haken ist gesetzt. Wenn ich aber mit dem Befehl Readeeprom den Speicher auslese erhalte ich nur die Werte 255,255....

Als Programmer habe ich das Programm STK500.exe verwendet

Ratber
21.05.2006, 08:19
also der Haken ist gesetzt. Wenn ich aber mit dem Befehl Readeeprom den Speicher auslese erhalte ich nur die Werte 255,255....


Wenn der Schreibvorgang und das nachfolgende Verify ok sind dann sollten dort aber deine Werte stehen die du mit übertragen hast.



Als Programmer habe ich das Programm STK500.exe verwendet

Ja,wenn du ein STK500 hast dann ist das richtig.

MAxK
21.05.2006, 13:38
Also ich habe hier aus den Bascom-samples diesen code ausprobiert:

'------------------------------------------------------------------
' EEPROM.BAS
' example on how to use the internal EEPROM
'------------------------------------------------------------------
'dimension some variables
Dim S As String * 5 , B As Byte , I As Byte , W As Word


'You can also dimension variables that must be stored into EEPROM
Dim Eb As Eram Byte At 13 , Ei As Eram Integer At 14 , El As Eram Long At 16 , Es As Eram String * 10 At 20
'We use the AT to indicate the address because we are using both modes in this example
'Normally you dont need this


'Now read 5 bytes from the EEPROM
'I is the address to read from and the lowest address is 0
'Note however that address 0 can be trashed during reset or start up.
'This is a fault in the AVR design.



For I = 0 To 4
Readeeprom B , I
Print B
Next


'Now write something from code into EEPROM
'assign variable
S = "abcde"
W = 10000
'write string
Writeeeprom S , 5
'Since length is 5 and we also need the ending null byte the next free address
'is 11

'write word
Writeeeprom W , 11

'Now reset the variables
W = 0
S = ""

'Read back
Readeeprom S , 5
Print S

Readeeprom W , 11
Print W


'Now write a byte to EEPROM
B = 10
Eb = B
'read it back
B = Eb
Print B


'Now write string
Es = S
S = ""
S = Es
Print S

'We dont do anything with the normal DATA in this example
'Restore Lbl
'Read b
'Print b


End


'The $EEPROM directive tells the compiler that the data lines that
'follow, must be written to a <prog>.EEP file
'This file can be programmed into the EEPROM
$eeprom
'Now we want to use 5 bytes
Data 1 , 2 , 3 , 4 , 5
'Normally a DATA statement will place the data in the flash ROM.
'So a $DATA statement is not necesarry.
'BUT since we used an $EEPROM directive above, we need to switch
'back to the normal default
$data
'The label named LBL will be used with the RESTORE statement
Lbl:
'Now define the DATA that will be placed in Flash ROM together with your program code
Data 10 , 12

und hier wird mir im Terminal nur 255,255.... angezeigt obwohl doch im Datensatz 1, 2, 3.. steht

Ratber
21.05.2006, 14:49
Hast du das Programm so überspielt wie es da steht ?
Ich sehe da keine Konfiguration (Crystal,Regfile) also vermutlich per Defaults im Compuler geregelt.
Das nochmal kontrolliert ?

Verify nach dem Schreiben ok ?


Wenn das alles stimmt dann sollte das EEProm auch laufen