I simply want to store some data in the EEPROM and read it out, however I cannot get it to work. The code is as follows:
'Program: eeprom testing Don Owen 10 July 2013
'Uses ATMega8535 micro
'**********************************************************************
$regfile = "m8535.dat" 'Uses ATMega8535
$crystal = 10000000
'$eeprom
'Config Eeprom = Mapped
Dim V as Eram Byte 'store in EEPROM
Dim B As Byte 'normal variable
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portd.3 , Db5 = Portd.2 , Db6 = Portd.1 , Db7 = Portd.0 , E = Portd.4 , Rs = Portd.5
Cursor Off
Config Portc = Input
Config Portd = Output
Portc = 255
Cls
Locate 1 , 1
Lcd "EEPROM"
Locate 2 , 1
Lcd "Testing Unit V1"
Wait 5
B = 7
V = B
Writeeeprom V , 1
Writeeeprom V , 2
Writeeeprom V , 3
Readeeprom B , 1
Cls
Lcd "stored 1 = " ; B
Wait 5
Readeeprom B , 2
Cls
Lcd "stored 2 = " ; B
Wait 5
Readeeprom B , 3
Cls
Lcd "stored 3 = " ; B
Wait 5
End
I should have been able to read 7 in all 3 locations but instead I get 0
I am obviously am doing something wrong so hopefully someone can show me the error of my ways.
Thanks
[b:be5c223071][color=red:be5c223071](BASCOM-AVR version : 2.0.7.6 )[/b:be5c223071][/color:be5c223071]
↧