I have a big problem with the compiler. It cannot point to the correct location. When I declared a pointer to a structure in EEPROM and try to access a member within it, the member pointed to is incorrect. Seems that it cannot add the offset address to the base address of the structure correctly especially when we are at the boundary of a sector/segment.
Has anyone encountered this? Any quick fix?
Eg,
struct A { char x; int y; }
A EEPROM* Var;
Var->y
To analyse your problem, one needs at least the memory model you're using, the linker settings and the exact code snippets.
I do not know about pointers, but offsets as in Ralph[offset] do not push the addressed item across a boundary, it 'folds' instead.
Erik
It Might be the case that the pointer is 16 bit by default for your compiler.
Suvidh
do not push the addressed item across a boundary, it 'folds' instead.
Actually it wraps around.
Doesn't folding specifically mean something that reaches a limit, and then reverses direction? An example is a digital filter, when the input frequency is above the Nyquist frequency.
"Doesn't folding specifically mean something that reaches a limit, and then reverses direction?"
No, I don't think there is any such specific definition!
I took Erik's "fold" to mean "wrap" - I'm sure he'll clarify...
"An example is a digital filter..."
Maybe "folding" does have a specific meaning in the specific context of digital filters...
well, one Dane (I guess) correcting another danes English, what a situation.
Yoe, I should have used 'wrap' instead of 'fold'
Just a bit to thw east and quite a bit to the north actually :)
700km north of Stockholm.
Exculse my mistake. I tend to recall that the Danish 'Per" usually is spelled 'Pär' in Sweden.
anyhow, "a Swede correcting a Danes English" is equally ironic.
Jag hoppas du maar bra
Tack, mycket bra :)
Soon banned for off-topic posts though...
We use both spellings in Sweden.
By the way: in many forums it is often the natives who have the most spelling and grammar errors.
http://www.keil.com/support/docs/2663.htm
"The far data pointer type is only 16 bits long, so it can only 'see' 64k of space."
and
"There is no pointer type, in C51, that can see more than 64k of data space at a time."
But see the article for possible workarounds...