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

Infinite loop

Hai all,
My program goes to infinite loop even though there is no while(1);

void main()
{
        uchar8_t ISMCheckResult;
    CKCON=0x04;
        DR=1;
    delay(50000);//Power on delay for testing  purpose
                enableLatch(0x00,0,7);
                delay(40);
                readBuffer(0,7);
                ISMCheckResult=IP_Sensing_check();
                Display(ISMCheckResult);
}


It stays in following Idata Loop....

IF IDATALEN <> 0
                MOV     R0,#IDATALEN - 1
                CLR     A
IDATALOOP:      MOV     @R0,A
                DJNZ    R0,IDATALOOP
ENDIF

what is the problem?
The functions in main I have used is very simple as follows...

void enableLatch(uchar8_t lactchValue,uchar8_t start,uchar8_t end)
{
 uchar8_t index1;
 DR=0;
         for(index1=start;index1<=end;index1++)
         {
          XBYTE[latchAddressTable[index1]]=lactchValue;
         }
 DR=1;
}
void readBuffer(uchar8_t start,uchar8_t end)
{
 uchar8_t index=0;
 DR=0;
         for(index=start;index<=end;index++)
         {
                Hardware_Buffer_Value[index]=XBYTE[bufferAddressTable[index]];
         }
 DR=1;
}
uchar8_t IP_Sensing_check(void)
{
 uchar8_t  Flag=0,i;
 DR=1;
         for(i=0;i<INPUT_BUFFERS;i++)
         {
                   if(Hardware_Buffer_Value[i]!=0)
                   {
                            Failed_Latch_Location[i]=ONE;
                                Flag++;
                   }
                   else
                   {
                        Failed_Latch_Location[i]=ZERO;
                   }
         }

 return((Flag>0)?ONE:ZERO);
}
void delay(uint16_t n)
{
 uint16_t i;
 for (i=0;i<n;i++);
}
void Display(uchar8_t Input_Sensing_check_result)
{
        uchar8_t  index;
    SCON = 0x50;
    TMOD = 0x20;
        TH1  = 0xFA;
    TR1  = 1;
        TI   = 1;
        DR=1;
/*      for(index=0;index<NO_OF_LATCHES_CHECK;index++)
        {
          printf("\nBuffer Contents %2bd %2bx\n",index+1,Hardware_Buffer_Value[index]);
        }
*/
        if(Input_Sensing_check_result!=ZERO)
                {
                            printf("\nChannel checking Failed\n");

                                for(index=0;index<NO_OF_LATCHES_CHECK;index++)
                                {
                                                 if(Failed_Latch_Location[index]!=ZERO)
                                                  {
                                                   printf("\nLatch/Buffer %2bx Failed\n ", index+1);
                                                  }
                                }
                }
        else
                {
                        printf("\nChannel checking OK\n");

                }
}

The output is coming correctly but it goes to infinite loop as if while(1){ //functions} is used....what is the problem kindly clarify me..

Parents
  • It stays in following Idata Loop....

    ... and you're sure of that? I ask because your other description of the problem is much less specific:

    infinite loop as if while(1){ //functions} is used..

    What are the exact symptoms?

    Oh, and what's the value of IDATALEN? Did you make any modifications to the startup code?

Reply
  • It stays in following Idata Loop....

    ... and you're sure of that? I ask because your other description of the problem is much less specific:

    infinite loop as if while(1){ //functions} is used..

    What are the exact symptoms?

    Oh, and what's the value of IDATALEN? Did you make any modifications to the startup code?

Children
No data