You have no items in your shopping cart.

Subtotal: 0.00

How to Interface LED with TMS320F2812 Stick

TMS320F2812 Stick Board

The TMS320F2812 Stick Board is specially designed for project developers in dsp field as well as beginners. The F2812 stick board is designed in such way that all the possible features of the DSP will be easily used by everyone.

The kit supports in Code Composer Studio v4 and later, with XDS100 v1 USB Emulator which is done USB port.



A Light Emitting Diodes (LEDs) are the most commonly used components, usually for displaying pin's digital states.


Interfacing LED with TMS320F2812

The TMS320F2812 Stick Board has two LED connected with DSC general purpose I/O pins. The Anode of each LED connects to ground and Cathode of each LED connects port line via 220Ω resistor. To light an individual LED, drive the associated port signal to High.


Circuit Diagram to Interface LED with TMS320F2812

In TMS320F2812 Stick Board, F2812 processor portb13 and portb14 is connected to the led.

C Program to On/OFF LED using TMS320F2812

Title : Program to Blink LEDs (main.c)

#include "DSP281x_Device.h" #define LED1 GpioDataRegs.GPBDAT.bit.GPIOB13 #define LED2 GpioDataRegs.GPBDAT.bit.GPIOB14 // Prototype statements for functions found within this file. void Gpio_select(void); void InitSystem(void); void Delay_1ms(long); void InitFlash(void); // Global symbols defined in the linker command file extern Uint16 RamfuncsLoadStart; extern Uint16 RamfuncsLoadEnd; extern Uint16 RamfuncsRunStart; void main(void) { InitSystem(); // Initialize the DSP's core Registers Gpio_select(); // Setup the GPIO Multiplex Registers memcpy(&RamfuncsRunStart,&RamfuncsLoadStart,&RamfuncsLoadEnd ­ &RamfuncsLoadStart); InitFlash(); // Initialize the Flash; Call original function from "DSP281x_SysCtrl.c" while(1) { LED1=1; LED2=1; Delay_1ms(1000); LED1=0; LED2=0; Delay_1ms(1000); } } void Gpio_select(void) { EALLOW; GpioMuxRegs.GPBMUX.all = 0x0; GpioMuxRegs.GPBDIR.all = 0x6000; //Port B13­B14 output EDIS; } void InitSystem(void) { EALLOW; SysCtrlRegs.WDCR= 0x0068; // Setup the watchdog // 0x00E8 to disable the Watchdog , Prescaler = 1 // 0x00AF to NOT disable the Watchdog, Prescaler = 64 SysCtrlRegs.SCSR = 0; // Watchdog generates a RESET SysCtrlRegs.PLLCR.bit.DIV = 10; // Setup the Clock PLL to multiply by 5 SysCtrlRegs.HISPCP.all = 0x1; // Setup Highspeed ClockPrescaler to divide by 2 SysCtrlRegs.LOSPCP.all = 0x2; // Setup Lowspeed CLockPrescaler to divide by 4 // Peripheral clock enables set for the selected peripherals. SysCtrlRegs.PCLKCR.bit.EVAENCLK=0; SysCtrlRegs.PCLKCR.bit.EVBENCLK=0; SysCtrlRegs.PCLKCR.bit.SCIAENCLK=0; SysCtrlRegs.PCLKCR.bit.SCIBENCLK=0; SysCtrlRegs.PCLKCR.bit.MCBSPENCLK=0; SysCtrlRegs.PCLKCR.bit.SPIENCLK=0; SysCtrlRegs.PCLKCR.bit.ECANENCLK=0; SysCtrlRegs.PCLKCR.bit.ADCENCLK=0; EDIS; } void Delay_1ms(long end) { long i; for (i = 0; i <(9000 * end); i++); }