附录一:protel原理图 最小系统原理图
19
LED原理图
20
附录二:protel PCB板图
21
附录三:程序源代码
/*************************头文件*********************************/ #include \ // DSP281x Headerfile Include File #include \ // DSP281x Examples Include File
Uint16 show=0x00aa; //定义欲显示值 Uint32 Xint1InterruptCount;
/**************************主程序*****************************/ void init_xint2(void); interrupt void xint2_isr(); void main(void) {
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP281x_SysCtrl.c file. InitSysCtrl();
// Disable CPU interrupts DINT;
// Initialize PIE control registers to their default state. // The default state is all PIE interrupts disabled and flags // are cleared. 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). InitPieVectTable();
22
EALLOW; // This is needed to write to EALLOW protected registers PieVectTable.XINT2 = &xint2_isr; EDIS; init_xint2();
// User specific code, enable interrupts: // Initialize count values to 0 Xint1InterruptCount = 0;
PieCtrlRegs.PIEIER1.all = M_INT5; IER |= M_INT1 ;
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM for(;;) {
if(Xint1InterruptCount<1) {
asm(\ *(int *)0x2200=show; }
else if(Xint1InterruptCount<2) {
asm(\
*(int *)0x2200=~show; } else {
Xint1InterruptCount = 0; } } }
void init_xint2(void)
23
{
XIntruptRegs.XINT2CR.all=0x0001; }
interrupt void xint2_isr(void) {
Xint1InterruptCount++;
// Acknowledge interrupt to receive more interrupts from PIE group 1 PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; }
24