EEpromPointer

fve
 
Avatar
 
Subject:

EEpromPointer

 · 
Posted: 07.07.2014 - 10:05  ·  #1
Hi all,

I got some code from a colleague, when compiling, i notice i get errors when pointing to eeprom.

for example:

i have a boolean stored in eeprom:
Set_value[$08C8] : boolean;

UParaPntr : pointer;
UParaPntr:= (@Set_value);


The compiler givers me the error:
"Error: Pointer to EEprom not possible"

When my colleague compiles, everyting works fine.

I know i need to call a special function to get/set the value in eeprom using a pointer.
but it goes wrong when i make the pointer refere to the eeprom address..

Do i have to set some special bit to enable pointers to EEprom?

The only difference between my version and the one of my colleague is that he has a newer version of the compiler.
(i am working with revision 5.04.32, but when i read the changes since my version, i notice nothing about pointer to eeprom)

Regards,
Flor
fve
 
Avatar
 
Subject:

Re: EEpromPointer

 · 
Posted: 08.07.2014 - 09:32  ·  #2
Hi,

Is there anyone who has an idea why my compiler gives errors when using pointers to eeprom?
Was this functionality added in a later version of the compiler? After 5.04.32? (i supose not, since i find references in the documentation of my compiler..)

i'm using an atmega 2560..

Regards,
Flor
mc-electronic
Benutzer
Avatar
Gender: n/a
Location: Sauerland NRW
Posts: 372
Registered: 03 / 2008
Subject:

Re: EEpromPointer

 · 
Posted: 08.07.2014 - 10:13  ·  #3
Hi Flor,

the information you give is quite frugal. Anyway, I have added

{$EEPROM}
StructConst
Set_value[$08C8] : boolean = TRUE;

to my program header, I have added

{$IDATA}
Var
UParaPntr : pointer;

to my variable definition and I added into the source just before the main loop

UParaPntr:= (@Set_value);

Everything compiles fine. (ACRco 5.04.72) I have tried an older version of the compiler (5.04.24), and that compiled too.

For further investigation it would be helpful, if you post a full, tiny test program, that shows the error.

Michael
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1409
Registered: 03 / 2005
Subject:

Re: EEpromPointer

 · 
Posted: 08.07.2014 - 13:23  ·  #4
Flor, just a quick question. You are not trying to store the pointer in EEPROM are you? That is what the error message suggests.
fve
 
Avatar
 
Subject:

Re: EEpromPointer

 · 
Posted: 08.07.2014 - 16:21  ·  #5
Hi Merlin,

No, i declaired my variable in eeprom,
The pointer is declaired in another unit, as a variable in ram...

the error "Pointer to EEprom not possible", referes to all the lines where i let the pointer point to the variables stored in eeprom..

unit E_Dec;
interface
{$IDATA}
const
.....

{$EEPROM}
var
...
Set_value[$08C8] : boolean;


---------------------------------------------

procedure xxx;
var
UParaPntr : pointer;
begin
UParaPntr:= (@Set_value);
end



But when i open the project in the old IDE, using version 5.04.32, i stell get the errors.

The good news is that i updated the software and now everything compiles as it should (5.04.77).
So i'll be working in version 5.04.77 from now on.

Thanks for looking into the problem anyway,

Regards,
Flor
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   91   105 · Page-Gen-Time: 0.034773s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI