⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 core timer.asm

📁 ADI 公司的DSP ADSP21369 EZ-KIT LITE开发板的全部源代码
💻 ASM
字号:
///////////////////////////////////////////////////////////////////////////////////////
//NAME:     Core Timer.asm
//DATE:     7/29/2005
//PURPOSE:  Core timer example for the ADSP-21369 Ez-kit
//USAGE:    Sets up the Core Timer and High Priority Interrupt
//          Toggles the flags for each timer interrupt serviced.
////////////////////////////////////////////////////////////////////////////////////////

#include <def21369.h>

// The following definition allows the SRU macro to check for errors. Once the routings have
// been verified, this definition can be removed to save some program memory space.
// The preprocessor will issue a warning stating this when using the SRU macro without this
// definition
#define SRUDEBUG  // Check SRU Routings for errors.
#include <SRU.h>

.global _main;
.global isr_timer;

#define N 0x1ffffff;
.extern _initPLL;
.extern _initSDRAM;


.section/dm seg_dmda;
.var LED06_value=0;
.var LED07_value=0;

.section/pm seg_pmco;

_main:

	call _initPLL;        //Initialize PLL for the correct core clock (CCLK) frequency
	call _initSDRAM;      //SDRAM is setup for use, but cannot be accessed until MSEN bit is enabled
	bit set IMASK TMZHI;  //Enable high priority timer interrupt
    bit set MODE1 IRPTEN; //Enable global interrupt

    TPERIOD = N;
    TCOUNT = N;

//Setting the SRU and route so that Flag pins connects to DPI pin buffers.
//Use Flags 4 to 15 only. Flags 0 to 3 not available on the DPI.

	SRU(FLAG6_O,DPI_PB08_I);	// Connect Flag6 output to DPI_PB08 input (LED1)
	SRU(FLAG7_O,DPI_PB13_I);	// Connect Flag7 output to DPI_PB13 input (LED2)
	SRU(FLAG4_O,DPI_PB06_I);	// Connect Flag4 output to DPI_PB06 input (LED3)
	SRU(FLAG5_O,DPI_PB07_I);	// Connect Flag5 output to DPI_PB07 input (LED4)
	SRU(FLAG8_O,DPI_PB14_I);	// Connect Flag8 output to DPI_PB14 input (LED5)

	SRU(LOW,DAI_PB15_I);		// Connect Input LOW to LED6
	SRU(LOW,DAI_PB16_I);		// Connect Input LOW to LED7

//Enabling the Buffer using the following sequence: High -> Output, Low -> Input

	SRU(HIGH,DPI_PBEN08_I);
	SRU(HIGH,DPI_PBEN13_I);
	SRU(HIGH,DPI_PBEN06_I);
	SRU(HIGH,DPI_PBEN07_I);
	SRU(HIGH,DPI_PBEN14_I);
	SRU(HIGH,PBEN15_I);
	SRU(HIGH,PBEN16_I);

//Setting flag pins
	bit set flags FLG3O|FLG4O|FLG5O|FLG6O|FLG7O|FLG8O;

//Clearing flag pins
	bit clr flags FLG3|FLG4|FLG5|FLG6|FLG7|FLG8;

//Setting flag pins so half the LED's light on (LED 1,3,5,7) while the other half stays off and Vice Versa
	bit set flags FLG6|FLG4|FLG8;

    bit set MODE2 TIMEN;    // enable core timer

_main.end: nop;
       jump (pc,0);         // wait here forever

//Timer ISR, toggle the LEDs
isr_timer:
        nop;
        bit tgl flags FLG6|FLG7|FLG4|FLG5|FLG8|FLG3; //light LED 1,2,3,4,5, & 8.

		//Procedure to light LED6
		ustat4=dm(LED06_value);
		bit tgl ustat4 0x1;
		dm(LED06_value)=ustat4;
		bit tst ustat4 0x1;

		//Test if bit is set
		if TF jump Flag06_Set;

		//if not, go to the "Clear Section" and set it to 1 again
	Flag06_Clear:
		SRU(LOW,DAI_PB15_I);	//light up LED6
		jump LED7;

	Flag06_Set:
		SRU(HIGH,DAI_PB15_I); 	//Turn off LED6

	   //Procedure to light LED7
LED7:   ustat4=dm(LED07_value);
		bit tgl ustat4 0x1;
        dm(LED07_value)=ustat4;
        bit tst ustat4 0x1;

        //Test if bit is set
		if TF jump Flag07_Set;

		//if not, go to the "Clear Section" and set it to 1 again
	Flag07_Clear:
		SRU(HIGH,DAI_PB16_I);	//turn off LED7
		rti;

	Flag07_Set:
		SRU(LOW,DAI_PB16_I);	//light up LED7

isr_timer.end: rti;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -