You are on page 1of 1

#include <LPC23XX.

h>

//Function Prototype
__irq void Timer0_IRQ(void);

/*Main Function Starts*/


int main()
{
//Port-0.0 tp Port-0.7 pins as Output Pin
FIO0DIR = 0x000000FF;

//Timer-0 Configuration
T0TCR = 0x02;
T0PR = 0x00000002;
T0MR0 = 0x00000002;
//500 msec Delay

T0MCR = 0x03;
//When TC = MR0, MR0 interrupt will Occur

T0TC = 0x00;
T0TCR = 0x01;
VICVectAddr4 = (unsigned)Timer0_IRQ;
VICIntSelect = 0;
VICIntEnable = 0x00000010;

while(1)
{
//Stay in Loop For-Ever
}
}

/*Function Definitions*/
/*Timer-0 IRQ Interrupt Service Routine Code*/
__irq void Timer0_IRQ(void) // Timer0 ISR
{
FIO0PIN ^= 0x000000FF;
T0IR = 0x00000000;
VICVectAddr = 0;
}

You might also like