Page 1 of 1

Easy question

Posted: Mon Oct 09, 2006 9:18 am
by SebaS
Hi guys! I've got a little question...... That's because my lack of knowledge, so I'd appreciate any answer....

How can I use pointers in C code???

I mean: I' ve got this in ASM code:

LDAA #BOTTOM_DISPLAY_MAP+1920

I want to that in C.... How can I do it?

for example I want to point to that address with the variable var1... Is like this: var1= &BOTTOM_DISPLAY_MAP+1920???

Is it necesary to difine var1 as some special type?

Thanks

Posted: Mon Oct 09, 2006 8:22 pm
by andrey
How can I use pointers in C code???
of course!
Code: Select all
/* very generally speaking: */
unsigned char *ptr;
ptr = (unsigned char *)(BOTTOM_DISPLAY_MAP+1920);
x = *ptr; /* read from that address */
However, for more detail, look at your AVR header files and see how these things are defined (particularly register mappings, etc). For example, take a look at how some random register, say PORTB is defined.

Posted: Thu Oct 12, 2006 3:47 am
by SebaS
Thanks a lot, man!!! :D