11.07.2015 Views

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Data storageIn the example below, the variable gamma is a structure placed in data20 memory.struct MyStruct{int alpha;int beta;};__data20 struct MyStruct gamma;The following declaration is incorrect:struct MySecondStruct{int blue;__data20 int green; /* Error! */};MORE EXAMPLESThe following is a series of examples with descriptions. First, some integer variables aredefined and then pointer variables are introduced. Finally, a function accepting a pointerto an integer in data16 memory is declared. The function returns a pointer to an integerin data20 memory. It makes no difference whether the memory attribute is placed beforeor after the data type. In order to read the following examples, start from the left and addone qualifier at each stepint a;int __data16 b;__data20 int c;int * d;int __data16 * e;int __data16 * __data20 f;int __data20 * myFunction(int __data16 *);A variable defined in default memorydetermined by the data model in use.A variable in data16 memory.A variable in data20 memory.A pointer stored in default memory. The pointerpoints to an integer in default memory.A pointer stored in default memory. The pointerpoints to an integer in data16 memory.A pointer stored in data20 memory pointing toan integer stored in data16 memory.A declaration of a function that takes aparameter which is a pointer to an integer storedin data16 memory. The function returns apointer to an integer stored in data20 memory.Part 1. Using the compiler19

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!