This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

timer and phyCORE Dev board

Hi all

When i run the program below in the simulator the program works fine and the LED blinks correctly in the simulator window.But if I download the program to the phyCORE dev board the LED in the board blinks for 8 times with the delay in the program and after that it is glowing for ever and kick me is printed in the Serial window for ever.

could anyone tell me why the program is not working correctly in the board?

Looking for your replies...

thanks

/******************************************************************************/
/*  This file is part of the uVision/ARM development tools                    */
/*  Copyright KEIL ELEKTRONIK GmbH 2002-2004                                  */
/******************************************************************************/
/*                                                                            */
/*  HELLO.C:  Hello World Example                                             */
/*                                                                            */
/******************************************************************************/

#include <stdio.h>                          /* I/O Functions */
#include <LPC22XX.H>                        /* LPC22XX Peripheral Registers */

 extern void init_serial (void);             /* Initialize Serial Interface */

 extern void init_timer (void);
 extern void delay (void);

 void delay (void)  {                        /* Delay Function */
  unsigned long x;

  for (x = 0; x < 400000; x++);
}

 void tc0 (void)__irq  {
   	 int n;
   printf("interrupt\n");

   IOSET0 = 0x00000100;
   T0TCR = 0;
  	  delay();



	for (n = 0x00010000; n <= 0x00800000; n <<= 1)
	{

	      delay();
	      printf("interrupt delay\n");

	 }

	T0IR=1;
	T0TCR = 1;
	 }




void main (void) {


  init_timer();
  init_serial();                            /* Initialize Serial Interface */

  IODIR0 = 0x00000100;                      /* P0.8 defined as Output */

  while(1)  {

        IOCLR0 = 0x00000100;
		printf(" Kick me\n");



  }
}


void init_timer (void)  {
  T0MR0 = 0x3;
  T0MCR = 3;                            // Interrupt and Reset on MR0
  T0PR=0x393870;

  VICVectAddr0 = (unsigned long)tc0;       // set interrupt vector in 0
  VICVectCntl0 = 0x20 |4 ;                 // use it for Timer 0 Interrupt
  VICIntEnable = 0x00000010;               // Enable Timer0 Interrupt
  T0TCR = 1;                               // Timer0 Enable

}

0