Hello,
for many things, I need the Funktion, that I can write word Variables into the EEprom (to calibrate ADC and so on)
Writing Word and Integer Varibales direkt into EEProm
-
- Posts: 8
- Joined: 08 Sep 2009 04:30
Hi, Guy!
i'm a new member!
i have some code, and i hope that it can help you!
void main()
{
unsigned long eeAddr;
int *ptrint;]
int a;
a=123;
//write EEPROM
eeAddr = 0x7FFC20;
ptrint = &a;
Eeprom_Write(eeAddr, *ptrint);
while(NVMCONbits.WR) ;
//read EEPROM
eeAddr = 0x7FFC20;
ptrint = &a;
*ptrint = Eeprom_Read(eeAddr);
}
....
it's ok.
Good luck!
i'm a new member!
i have some code, and i hope that it can help you!
void main()
{
unsigned long eeAddr;
int *ptrint;]
int a;
a=123;
//write EEPROM
eeAddr = 0x7FFC20;
ptrint = &a;
Eeprom_Write(eeAddr, *ptrint);
while(NVMCONbits.WR) ;
//read EEPROM
eeAddr = 0x7FFC20;
ptrint = &a;
*ptrint = Eeprom_Read(eeAddr);
}
....
it's ok.
Good luck!
Perhaps this can be also of some help: http://users.edpnet.be/rosseel01/DRO/PI ... iable.mpas.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
@Dany
thanks, but do you have an example how I use it?
I will write the Number 1020 for example, and then read it...
I don't know what I have to do with this
The procedures/functions need following parameters:
- the address of the valiable
- the size of the valiable
- the first (lowest) address in Eeprom to write to or read from
thanks
thanks, but do you have an example how I use it?
I will write the Number 1020 for example, and then read it...
I don't know what I have to do with this
The procedures/functions need following parameters:
- the address of the valiable
- the size of the valiable
- the first (lowest) address in Eeprom to write to or read from
thanks
corado wrote:@Dany
thanks, but do you have an example how I use it?
I will write the Number 1020 for example, and then read it...
I don't know what I have to do with this
The procedures/functions need following parameters:
- the address of the valiable
- the size of the valiable
- the first (lowest) address in Eeprom to write to or read from
thanks
Code: Select all
var MyVar: word;
EePromAddress: word;
...
MyVar := 1020; // MyVar gets some value
// write action
EePromAddress := 4; // the "MyVar" content will reside in EeProm place 4 and 5 for example
EePromWriteVariable(@MyVar, sizeof(MyVar), EePromAddress);
...
// read back action
EePromAddress := 4;
EePromReadVariable(@MyVar, sizeof(MyVar), EePromAddress);
Code: Select all
...
EePromWriteVariable(@MyVar, sizeof(MyVar), 4);
...
EePromWriteVariable(@MyVar, sizeof(MyVar), 4);
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
No, idea, I work with PIC's only for now.corado wrote:And how can I write something into EEprom with AVRStudio, also via ISP Programmer?
In AVRco Pascal will be generatet an .eep File , this I can flash with ISp into the Atmega
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)