Professional Documents
Culture Documents
Where,
Join the Technical Community Today!
http://www.pantechsolutions.net
Procedure
Note: Once you install the Code Composer Studio v 3.3 software,
the two icons will display in desktop
I. Setup Code Composer Studio v3.3
II. Code Composer Studio
1. Open Setup Code Composer Studio v3.3.
2. In System Configuration, select the board then Remove all
yes.
a. In family, select C28xx.
b. In platform, select xds100 usb emulator.
c. In Endianness, select little.
d. Select F2812 XDS100 USB Emulator add save & quit
no.
Note: The above two steps only for first time to setup the
processor in CCS.
3. Open Code Composer Studio v3.3.
4. Project New.
a. Project name: type the project name.
b. Location: Browse, select the project location .
c. Project Type: Executable(.out)
d. Target: TMS320C28XX. Finish.
Join the Technical Community Today!
http://www.pantechsolutions.net
Program
#include "DSP281x_Device.h"
#include "IQmathLib.h"
#pragma DATA_SECTION(sine_table,"IQmathTables");
_iq30 sine_table[512];
void InitSystem(void);
void InitPieCtrl();
void InitPieVectTable();
interrupt void T1_Compare_isr(void);
void main()
{
InitSystem();
EALLOW;
GpioMuxRegs.GPAMUX.all = 0x0040;
EDIS;
Join the Technical Community Today!
http://www.pantechsolutions.net
InitPieCtrl();
InitPieVectTable();
EALLOW;
PieVectTable.T1CINT = &T1_Compare_isr;
EDIS;
PieCtrlRegs.PIEIER2.bit.INTx5 = 1;
enable PIE GP Timer 1 compare interrupt
//
IER = 2;
EINT;
ERTM;
EvaRegs.T1CNT = 0x0000;
EvaRegs.T1PR = 0x1312;
period value for 12.8khz carrier pwm freq
//
EvaRegs.T1CMPR = 0x0989;
50% duty cycle
//
EvaRegs.GPTCONA.bit.TCMPOE = 1;
// Drive T1/T2 PWM by compare logic
EvaRegs.GPTCONA.bit.T1PIN = 1;
Polarity of GP Timer 1 Compare = Active low
//
EvaRegs.EVAIMRA.bit.T1CINT = 0;
enable GP Timer 1 compare interrupt
//
EvaRegs.T1CON.all = 0x1042;
Enable GP Timer
//
for(;;);
}
void InitSystem()
{
EALLOW;
SysCtrlRegs.WDCR= 0x0068;
Setup the watchdog
//
//
//
0x00AF to NOT disable the Watchdog, Prescaler = 64
SysCtrlRegs.SCSR = 0;
Watchdog generates a RESET
//
SysCtrlRegs.PLLCR.bit.DIV = 10;
the Clock PLL to multiply by 5
// Setup
SysCtrlRegs.HISPCP.all = 0x1;
Highspeed Clock Prescaler to divide by 2
// Setup
SysCtrlRegs.LOSPCP.all = 0x2;
Lowspeed CLock Prescaler to divide by 4
// Setup
SysCtrlRegs.PCLKCR.bit.ADCENCLK=0;
EDIS;
}
void T1_Compare_isr(void)
{
static int index=0;
EvaRegs.T1CMPR = EvaRegs.T1PR _IQsat(_IQ30mpy(sine_table[index]+_IQ30(0.9999),EvaRegs.T1PR
/2),EvaRegs.T1PR,0);
index +=1;
if (index >511) index = 0;
EvaRegs.EVAIFRA.bit.T1CINT = 1;
Reset T1 Compare Interrupt Flag
//
PieCtrlRegs.PIEACK.all = PIEACK_GROUP2;
//
Acknowledge this interrupt to receive more interrupts from group
2
}
Join the Technical Community Today!
http://www.pantechsolutions.net
Result
Thus, the 50Hz SPWM was generated using Boot Rom Table
in TMS320F2812 Kit.
What do we sell?
Our products range from Various Microcontroller
development boards, DSP Boards, FPGA/CPLD boards,
Communication Kits, Power electronics, Basic electronics,
Robotics, Sensors, Electronic components and much more . Our
goal is to make finding the parts and information you need
easier and affordable so you can create awesome projects and
training from Basic to Cutting edge technology.