Hi guys. Just a quick one (I think), I'm going through some code and some definitions have thrown me a bit.
tPID fooPID; // Declare a PID Data Structure named, fooPID. tPID structure is defined in dsp.h
fractional abcCoefficient[3]__attribute__((space(xmemory))); // find a place to put the data, use
fractional controlHistory[3]__attribute__((space(ymemory))); // large data model in project build options
//fractional kCoeffs[] = {0,0,0}; // declare Kp, Ki and Kd
tPID is a structure defined in the dsp.h file as follows:
typedef struct {
fractional* abcCoefficients; /* Pointer to A, B & C coefficients located in X-space */
/* These coefficients are derived from */
/* the PID gain values - Kp, Ki and Kd */
fractional* controlHistory; /* Pointer to 3 delay-line samples located in Y-space */
/* with the first sample being the most recent */
fractional controlOutput; /* PID Controller Output */
fractional measuredOutput; /* Measured Output sample */
fractional controlReference; /* Reference Input sample */
} tPID;
abdCoefficient and controlHistory are fractional pointer elements of that structure. I just have a couple of questions. Why does the pointer itself need to be fractional, to point to a fractional data type? and secondly, what is xmemory and ymemory, and why is it used here?
Thank you!
tPID fooPID; // Declare a PID Data Structure named, fooPID. tPID structure is defined in dsp.h
fractional abcCoefficient[3]__attribute__((space(xmemory))); // find a place to put the data, use
fractional controlHistory[3]__attribute__((space(ymemory))); // large data model in project build options
//fractional kCoeffs[] = {0,0,0}; // declare Kp, Ki and Kd
tPID is a structure defined in the dsp.h file as follows:
typedef struct {
fractional* abcCoefficients; /* Pointer to A, B & C coefficients located in X-space */
/* These coefficients are derived from */
/* the PID gain values - Kp, Ki and Kd */
fractional* controlHistory; /* Pointer to 3 delay-line samples located in Y-space */
/* with the first sample being the most recent */
fractional controlOutput; /* PID Controller Output */
fractional measuredOutput; /* Measured Output sample */
fractional controlReference; /* Reference Input sample */
} tPID;
abdCoefficient and controlHistory are fractional pointer elements of that structure. I just have a couple of questions. Why does the pointer itself need to be fractional, to point to a fractional data type? and secondly, what is xmemory and ymemory, and why is it used here?
Thank you!