Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

IAR LPC2129 TIMER INTERRUPT PROGRAM not work

Status
Not open for further replies.

ziedg

Newbie level 5
Joined
Sep 14, 2010
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,350
i try to debug this program with IAR and olimex-P2129 and
the program don't launch any interrupt .

why the interrupt is not execute ?! any idea please

/*------------------------------------------------------------------------------\
-------------------------------------------------*/
#include <iolpc2129.h>
#include "hardware.h"
long timeval=0;

__irq __arm void tc0 (void); // Generate Interrupt
void init_timer (void);

/*------------------------------------------------------------------------------\
-------------------------------------------------*/
void main(void)
{
CPUinit();
init_timer();
A_LED1_ON;
while(1);
}


/* Setup the Timer Counter 0 Interrupt */
void init_timer (void)
{
T0MR0 = 149999; // 10mSec = 150.000-1 counts
T0MCR = 0x03; // Interrupt and Reset on MR0
T0TCR = 0x01; // Timer0 Enable
VICIntSelect = 0x00;
VICVectAddr0 = (U32)tc0; // set interrupt vector in 0
VICVectCntl0 = 0x20 | 4; // use it for Timer 0 Interrupt
VICIntEnable = 0x00000010; // Enable Timer0 Interrupt
}


/* Timer Counter 0 Interrupt executes each 10ms @ 60 MHz CPU Clock */
__irq __arm void tc0 (void)
{
A_LED1_OFF;
VICVectAddr = 0x00; // Acknowledge Interrupt
T0IR = 0x01; // Clear interrupt flag
}



this is the code of CPUinit();

void CPUinit(void)
{
PLLCFG_bit.MSEL=3; //M=3(4?),P=1(2?) PLLfreq = 235,9296 Mhz,
CCLK = 58,9824 Mhz
PLLCFG_bit.PSEL=1;
PLLFEED=0xAA;
PLLFEED=0x55;
PLLCON_bit.PLLE=1; // Enable the PLL
PLLFEED=0xAA;
PLLFEED=0x55;
while(!(PLLSTAT & PLOCK)); // Wait for PLL to lock

//Init MAM & Flash memory fetch
MAMCR_bit.MODECTRL=2;
MAMTIM_bit.CYCLES=4;
VPBDIV_bit.VPBDIV=1; //pclk = cclk

//GPIO init
A_PULL_UP;
A_LED1_OFF;
A_LED2_OFF;
PINSEL0=0; //P0 lower 16 bits all GPIO
PINSEL1=0; //P0 upper 16 bits all GPIO


IO0DIR=0x01003101;
//IODIR in binary 0000 0001 0000 0000 0011 0001 0000 0001 //...P0.12, P0.13
are output(LEDs) also TXD0,TXD1,TD2

VICProtection = 0;

}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top