Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE
Tool/software: Code Composer Studio
Is there any example program file for PI Controller?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE
Tool/software: Code Composer Studio
Is there any example program file for PI Controller?
Hi,
We offer PI/PID library and example project in digital control library (DCL). Please download latest version C2000ware and install it in default location. You can then find DCL in the path below:
C:\ti\c2000\C2000Ware_3_03_00_00\libraries\control\DCL\c28
Thanks.
Han
1. I found DCL folder but the PI controller program in it was in assembly language. Is there any example in embedded C Language for PI Controller?
2. I tried to measure the time taken by the CLA task with the help of EPWM TBCTR register. It worked
3. The following way didn't work to measure the cla task time taken
for your reference,
During Initialization,
void Init_Gpio()
{
//-----Port A Consists of GPIO0-GPIO31
//-----Port B Consists of GPIO32-GPIO63
//-----Port C Consists of GPIO64-GPIO95
//-----Port D Consists of GPIO96-GPIO127
//-----Port E Consists of GPIO128-GPIO159
//-----Port F Consists of GPIO160-GPIO168
EALLOW;
GpioCtrlRegs.GPAGMUX2.bit.GPIO26 = 0; // 0|0=GPIO 0|1=OUTPUTXBAR1 0|2=EQEP2A 0|3=MDXB
GpioCtrlRegs.GPAMUX2.bit.GPIO26 = 0; // 1|0=GPIO 1|1=rsvd 1|2=SPISIMOB 1|3=SD2_D1
GpioCtrlRegs.GPAPUD.bit.GPIO26 = 0; // Enable pullup on GPIO26
GpioCtrlRegs.GPAMUX2.bit.GPIO26 = 0; // GPIO26 = GPIO26
GpioCtrlRegs.GPADIR.bit.GPIO26 = 1; // GPIO26 = output
EDIS;
}
During CLA task beginning
interrupt void Cla1Task1(void)
{
__meallow();
GpioDataRegs.GPADAT.bit.GPIO26 = 1;
__medis();
...
...
...
...
...
__meallow();
GpioDataRegs.GPADAT.bit.GPIO26 = 0;
__medis();
}
For 1, DCL has library for PI in both C and asm. C version functions can be found in
C:\ti\c2000\C2000Ware_3_03_00_00\libraries\control\DCL\c28\include\DCLF32.h
and example projects can be found in
C:\ti\c2000\C2000Ware_3_03_00_00\libraries\control\DCL\c28\examples
For 3, you will need to set the master control of the GPIO pin to CLA to toggle a pin on CLA by setting the "GPIO A Core Select Register" GPACSELx. For your example, you will need to add the line below into GPIO initialization.
GpioCtrlRegs.GPACSEL4.bit.GPIO26 = 0x1;
BTW, you will NOT need to do __meallow for GPIO data register.