Posted: Fri May 29, 2015 2:49 am Post subject: Writing to EEPROM
Hello,
I have a microprocessor circuit that for safety reasons only get power when a some buttons are pressed. This can happen up to 20 times a minute.
I am a little confused when and how to write to the EEPROM....
I only want to write the "Company_Name" to the EEPROM when the program is being downloaded. Also, is it necessary to Dim the "E_sp_a As Eram Integer" every time the programs runs? It is usually only written to ones, first time the program runs.
Writeeeprom Company_name , 0'ONLY WRITING TO EEPROM WHEN PROGRAM IS DOWNLOADED Writeeeprom Program_ver , 16'ONLY WRITING TO EEPROM WHEN PROGRAM IS DOWNLOADED
Dim Sp_a AsInteger Dim Sp_b AsInteger Dim E_sp_a AsEramIntegerAt48 Dim E_sp_b AsEramIntegerAt64 'Dim another 12 items as Eram Integers
Do 'My Program Gosub Set_up_routine 'THIS SUB IS NORMALLY ONLY CALLED ONES AFTER PROGRAM HAS BEEN DOWNLOADED Loop
Set_up_routine: 'Do the set-up, then
E_sp_a = Sp_a 'ONLY WRITING TO EEPROM WHEN IN Set_up_routine
E_sp_b = Sp_b 'ONLY WRITING TO EEPROM WHEN IN Set_up_routine 'another 12 'ONLY WRITING TO EEPROM WHEN IN Set_up_routine Return
_init_micro: 'do something" Return
(BASCOM-AVR version : 2.0.7.7 , Latest : 2.0.7.8 )
This code generate also *.eep file. You should check "upload code and data" in Your programmer. Then when programming micro eeprom will be programmed too. You should not use location at 0. It is described in datasheet. Remmember that string declared as 15 characters takes 16 bytes/addresses. This is only example that can be tested in simulator
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum