Quote:
This code fragment contains some global variables, we cannot see how they are declared, initialized and probably used somewhere else
Thanks a lot to write here. Yes this code has global variable like Global.c. But this file explains to call internal and external memory and RAM. A summary can find here, DSP Global Variable Specification Syntax[^] Looking at the first defination,
in_data = Register[CH1_VOLTAGE] * 1000 - Vfilt_16;
Register[CH1_VOLTAGE]=float Register[COUNT_OF_REGISTER]; Vfilt_16 is also a register value. About k the C2000 digital lib manual says, Proportional gain is usually applied directly to servo error, however, a feature of this controller is that sensitivity of the proportional path to the reference input can be weighted differently from that of the feedback input. This is achieved through the Kr variable, and provides an additional degree of freedom when tuning the controller. The proportional control law is shown in Equation v5 (k) = Krr(k) - y(k) In most situations the weighting gain Kr will be unity. Its a PID controller equation. Such functions are typically based on integrating the transient error over a fixed time interval. The DCL.h library header file includes a set of default floating-point values that can be used for initialization purposes. These configure the proportional path to have unity gain, zero integral gain, output saturation limits of ±1.
#define PI_DEFAULTS { 1.0f, \
0.0f, \
0.0f, \
1.0f, \
-1.0f, \
1.0f \
}
An example of the C declaration of an initialized PI structure is: PI pi1 = PI_DEFAULTS; The formation of the graph can be find here,7.7. Graph Tools — Code Composer Studio 9.3.0 Documentation[^]