Example Usage Flow
Example Usage Flow
// Step 0. Include required header files
// DSP281x_Device.h: device specific definitions #include statements
// for all of the peripheral .h definition files.
// DSP281x_Example.h is specific for the given example.
#include "DSP281x_Device.h"
// Prototype statements for functions found within this file.
interrupt void cpu_timer0_isr(void);
void main(void)
{
// Step 1. Initialize System Control registers, PLL, WatchDog, Clocks to de-
fault state:
// This function is found in the DSP281x_SysCtrl.c file.
InitSysCtrl();
// Step 2. Select GPIO for the device or for the specific application:
// This function is found in the DSP281x_Gpio.c file.
InitGpio();
// Step 3. Initialize PIE vector table:
// The PIE vector table is initialized with pointers to shell Interrupt
// Service Routines (ISR). The shell routines are found in
DSP28_DefaultIsr.c.
// Insert user specific ISR code in the appropriate shell ISR routine in
// the DSP281x_DefaultIsr.c file.
// Disable and clear all CPU interrupts:
DINT;
IER = 0x0000;
IFR = 0x0000;
// Initialize Pie Control Registers To Default State:
// This function is found in the DSP281x_PieCtrl.c file.
InitPieCtrl();
// Initialize the PIE Vector Table To a Known State:
// This function is found in DSP281x_PieVect.c.
// This function populates the PIE vector table with pointers
// to the shell ISR functions found in DSP281x_DefaultIsr.c.
InitPieVectTable();
// Step 4. Initialize all the Device Peripherals to a known state:
// This function is found in DSP281x_InitPeripherals.c
InitPeripherals();
// Step 5. User specific functions, Reassign vectors (optional), Enable Inter-
rupts:
// Initialize CPU Timer 0:
// > Set Up For 1 Second Interrupt Period
// > Point To "cpu_timer0_isr" function
// Reassign CPU-Timer0 ISR.
// Reassign the PIE vector for TINT0 to point to a different ISR then
// the shell routine found in DSP281x_DefaultIsr.c.
// This is done if the user does not want to use the shell ISR routine
// but instead wants to use their own ISR. This step is optional:
C28x - Peripheral Registers Header Files 3 - 13