2532 views|0 replies

1

Posts

0

Resources
The OP
 

How to use PieVectTable in DSP2812 [Copy link]

In routine 1

#include "DSP28_Device.h"

unsigned int *LedADDR = (unsigned int *) 0x2800; //8 LED register addresses

unsigned int Count,Flag;
//////////////////The corresponding bit has a low level, which lights up the LED
const Uint16 LedCode[9]={0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xFE,0xFF};

interrupt void ISRTimer0(void);

void main(void)
{
InitSysCtrl(); //Initialize system

DINT; //Disable interrupt
IER = 0x0000;
IFR = 0x0000;

InitPieCtrl(); //Initialize PIE
InitPieVectTable(); //Initialize PIE interrupt vector table
InitPeripherals(); //Initialize peripherals
InitGpio();
EALLOW;
PieVectTable.TINT0 = &ISRTimer0;
EDIS;

Count = 0; //Initialize variable
Flag=0;
ConfigCpuTimer(&CpuTimer0, 10, 10000000); //Set CPU
StartCpuTimer0();

IER |= M_INT1; //Open interrupt
PieCtrl.PIEIER1.bit.INTx7=1;

EINT; // INTM allowed
ERTM; // DBGM allowed

*LedADDR = 0x00; // Turn on all 8 LEDs
for(;;)
{ ; }

}

interrupt void ISRTimer0(void)
{
PieCtrl.PIEACK.bit.ACK7=1;
*LedADDR = LedCode[Count]; //Turn on the lights one by one and set the corresponding bits to low level
if (Flag==0) Count++;
if (Count>=8)//loop
{
Flag=0;
Count=0;}

}

In routine 9

#include "DSP28_Device.h"

unsigned int *LedADDR = (unsigned int *)0x2800; //LED control register

interrupt void ExtIntISR(void);

Uint16 Temp;

void main(void)

{

InitSysCtrl(); //Initialize the system

DINT; //Disable interrupt

IER = 0x0000;

IFR = 0x0000;

InitPieCtrl(); //Initialize PIE

InitPieVectTable(); //Initialize PIE interrupt vector table

InitPeripherals(); //Initialize peripherals

InitGpio(); //Initialize GPIO

InitXIntrupt(); //Initialize external interrupt

EALLOW;

PieVectTable.XINT1 = &ExtIntISR;

EDIS;

*LedADDR=0xFF; //turn off all led lights

IER |= M_INT1; //Open interrupt

PieCtrl.PIEIER1.bit.INTx4 = 1; //Bit 4 in PIE group 1 where external interrupt 1 is located

EINT; // Enable INTM

ERTM; // Enable DBGM

Temp=0xFF;

for(;;);

}

interrupt void ExtIntISR(void)

{

PieCtrl.PIEACK.all = 0xFFFF;

PieCtrl.PIEIFR1.bit.INTx4 = 0;

ERTM;

Temp^=0xFF;

*LedADDR = Temp;

}

PieVectTable appears. I would like to ask what it is and how to use it. Thank you.

This post is from Analogue and Mixed Signal

Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list