Chapter 7

X and Y Data Spaces

The dspic-utility.h header file defines two macros that tell the compiler to allocate storage in the dsPIC X and Y data spaces.

7.1  Usage

To use these macros, you can use the -I compiler option to add the dsPIC Helper Library source directory to the compiler command line, and then include the header file like so:

  #include <dspic-utility.h>

7.2  Macros

XSPACE   macro

Expands to a compiler attribute to tell the compiler to allocate storage in the X data space. For example, the following code will allocate the data for the array in the X data space:

  int16_t abcCoeffs[3] XSPACE;

YSPACE   macro

Expands to a compiler attribute to tell the compiler to allocate storage in the Y data space. For example, the following code will allocate the data for the array in the Y data space:

  int16_t controlHistory[3] YSPACE;