Hello!
I'm trying to tranin with CCS 4 ( 4.0.2.01003 ) for a stepper motor driving application.
I'm using Piccolo experimental kit with 28035 processor, connected with a custom power board. I started from Piccolo-B header e peripheral control library, sprc892, to gain acces to various modules. In particular, I've PWM and ADC running.Then I tried to use PID library, with no success.
I loaded "${workspace_loc:/iqDMC_ml}" as project in workspace and compiled as library.
I included math functions folders in c2000 compiler -> include options
"${workspace_loc:/iqDMC_ml}"
"C:\TI_F28xxx_SysSW\~SupportFiles\lib\DMClib\cIQmath\include"
"C:\TI_F28xxx_SysSW\~SupportFiles\lib\IQmath\cIQmath\include"
and included library in c2000 linker->file search path > include library file as input box
"${workspace_loc:/iqDMC_ml/Debug/iqDMC_ml.lib}"
(it worked well with 2xPM_Motors demo)
then I Added .h
#define GLOBAL_Q 15 /* Set the Local Q value */
#include "IQmathlib.h"
#include "pid_reg3.h"
initialized pid in main
// init pid
pid1.Kp = _IQ(0.5); // Pass _iq parameters to pid1
pid1.Ki = _IQ(0.001); // Pass _iq parameters to pid1
pid1.Kd = _IQ(0.01); // Pass _iq parameters to pid1
pid1.Kc = _IQ(0.9); // Pass _iq parameters to pid1
then I use pid in a function called in an ISR
pid1.Ref = _IQ(0.2); // Pass _iq inputs to pid1
pid1.Fdb = _IQ(0.15); // Pass _iq inputs to pid1
pid1.calc(&pid1); // Call compute function for pid1
At pid1.calc it don't run the right funcion, but I fall in ILLEGAL_ISR
Any suggestion?
Regards, Loriano.