SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
User avatar
By SebaS
#20225
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
By andrey
#20235
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.
User avatar
By SebaS
#20398
Thanks a lot, man!!! :D