Welcome to graduate2professional.blogspot.com

Friday, November 6, 2009

Accessing fixed memory locations

Embedded systems are often characterized by requiring the programmer to access a specific memory location. On a certain project it is required to set an integer variable at the absolute address 0x67a9 to the value 0xaa55.
Example:
int *ptr;
ptr = (int *)0x67a9;
*ptr = 0xaa55;

A more obscure approach is:*(int * const)(0x67a9) = 0xaa55;

No comments:

Post a Comment