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

Sample program hanging while debugging

I am currently doing a project to set up a climate monitoring system by sending data recieved through a temperature sensor on AT89C51ED2(ESA MCB 51-2 development board) to a Xbee module. I have recently started having some problem with the board. Even on trying a simple program like Blinky on the board, when I am debugging and running it using Keil uVision, the program gets stuck and eventually it shows connection to system lost after which I have to reset it but the problem still remains.

I am using the baud rate as 38400 bps and I dont think there is any problem with the COM Ports as the program is getting identified in Keil but then not running.

The code is the following

/* BLINKY.C - LED Flasher for the Keil MCBx51 Evaluation Board with 80C51 device*/

#include <at89c51xd2.h>
#include <REG51F.H>

void wait (void)  {                   /* wait function */
  ;                                   /* only to delay for LED flashes */
}

void main (void)  {
  unsigned int i;                     /* Delay var */
  unsigned char j;                    /* LED var */

  while (1) {                         /* Loop forever */
    for (j=0x01; j< 0x40; j<<=1)  {   /* Blink LED 0, 1, 2, 3, 4, 5, 6, 7 */
      P1 = j;                         /* Output to LED Port */
      for (i = 0; i < 50000; i++)  {  /* Delay for 10000 Counts */
       wait ();                       /* call wait function */
      }
    }

    for (j=0x40; j> 0x01; j>>=1)  {   /* Blink LED 7, 6, 5, 4, 3, 2, 1 */
      P1 = j;                         /* Output to LED Port */
      for (i = 0; i < 50000; i++)  {  /* Delay for 10000 Counts */
       wait ();                       /* call wait function */
      }
    }
  }
}

It would be really great if you could help me.
Thanks and Regards
Pratyush

0