Вы находитесь на странице: 1из 2

Generated by Unregistered Batch DOC & DOCX Converter 2009.1.1120.1346, please register!

DSP Assigment 4 Using a Timer on DSP


1. Create a new project Timer_LED. In this project, use timer1 to generate interrupt after every 2 seconds. At the occurrence of interrupt, toggle LED 0. Consequently, LED 0 will flash with 2 seconds ON and 2 seconds OFF. Hint: Use following functions to access LEDs. DSK6713_LED_init( ) [For initialization, call once at the start of code] DSK6713_LED_on(n) DSK6713_LED_off(n) DSK6713_LED_toggle(n) where n = 0, 1, 2 ,3 indicating the LED to access.

#include <stdio.h> #include <csl.h> #include <csl_timer.h> #include <csl_irq.h>

#define TIMER_CNT 20 /* Maximum count value */ static int cnt = 0;

void main() { /* Initialize the chip support library, must when using CSL */

CSL_init(); DSK6713_LED_init(); DSK6713_LED_on(0); IRQ_map(IRQ_EVT_TINT1, 10); // Map T1 interrupt onto INT11 IRQ_globalEnable(); // Globally enable interrupts // Enable T1 interrupt

IRQ_enable(IRQ_EVT_TINT1); while(1);

Generated by Unregistered Batch DOC & DOCX Converter 2009.1.1120.1346, please register! }

/*------------------Timer 1 ISR ---------------------------Increments a count value every time when interrupt occurs and exit the program when count reaches TIMER_CNT value -------*/

void HWI_T1(void) { DSK6713_LED_toggle(0);

return; }

Вам также может понравиться