这是一个 TI DSP2812 的 GPIO 的应用: 跑马
灯程序,可以让 8 个 Led 灯,每隔一秒钟依序
轮流闪烁,附录了完整的程序批注
//
#####################################
#####################################
#
//
// file: Example_281xGpio_Led.c Edited by
Steven-Tsao
//
// TITLE: DSP281x GPIO LED Test
//
//
// This program requires the DSP281x
V1.00 header files.
// As supplied, this project is configured
for "boot to H0" operation.
//
// To work properly this test requires
hardware configuration described
// below.
//
//
#####################################
#####################################
#
//
#####################################
#####################################
#
#include "DSP281x_Device.h" // DSP281x
Headerfile Include File
#include "DSP281x_Examples.h" //
DSP281x Examples Include File
// Prototype statements for functions found
within this file.
Uint16 j=0x0001;
short i ;
void Gpio_select(void);
void delay_loop(Uint16 loop_time);
void main(void)
{
// Step 1. Initialize System Control registers,
PLL, WatchDog,
// peripheral Clocks to default state:
// This function is found in the
DSP281x_SysCtrl.c file.
InitSysCtrl();
// Step 2. Initalize GPIO:
// This example function is found in the
DSP281x_Gpio.c file and
// illustrates how to set the GPIO to it's default
state.
// InitGpio(); // Skipped for this example
// Step 3. Clear all interrupts and initialize PIE
vector table:
// Disable CPU interrupts
DINT;
// Initialize PIE control registers to their
default state.
// The default state is all PIE interrupts
disabled and flags
// are cleared.
// This function is found in the
DSP281x_PieCtrl.c file.
InitPieCtrl();
// Disable CPU interrupts and clear all CPU
interrupt flags:
IER = 0x0000;
IFR = 0x0000;
// Initialize the PIE vector table with pointers
to the shell Interrupt
// Service Routines (ISR).