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

📄 main.c

📁 2812的最小设计方案和基本编程的源码
💻 C
字号:

#include "DSP28_Device.h"


unsigned int * LedReg  = (unsigned int *) 0x23FF;
	 	
void main(void)
{

// Step 1. Initialize System Control registers, PLL, WatchDog, Clocks to default state:
// This function is found in the DSP28_SysCtrl.c file.
	InitSysCtrl();

// Step 2. 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 DSP28_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 DSP28_PieCtrl.c file.
	InitPieCtrl();

	/*初始化PIE中断矢量表*/	
	InitPieVectTable();	

	
	/*初始化外设*/
    InitPeripherals();
    

    /*开中断*/
	IER |= M_INT1;
	PieCtrl.PIEIER1.bit.INTx7=1;
	
// Enable global Interrupts and higher priority real-time debug events:
	EINT;   // Enable Global interrupt INTM
	ERTM;	// Enable Global realtime interrupt DBGM

//********************* initial *******************************************


	*LedReg = 0xFF;    // 关 LED

	while(1) ;

}

//===========================================================================
// No more.
//===========================================================================

⌨️ 快捷键说明

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