a call to delay subroutine results infinite loop

Discussion in 'Embedded Systems and Microcontrollers' started by raghav442, Jan 28, 2013.

  1. raghav442

    Thread Starter New Member

    Jan 28, 2013
    1
    0
    I'm using keil uvision 4 and learning programming for AT89s52 , I'm using 12MHZ frequency.


    I have written a subroutine for a delay of 10 micro sec which is in another file called DELAY.ASM and made a call from DELAYCALL.ASM to it, but the call results in an infinite loop.I just dont have a clue why this behaviour, please help?clarify this phenomenon


    DELAYCALL.ASM

    $INCLUDE(DELAY.ASM)
    CSEG AT 0
    ACALL DELAY10MICROSEC
    END


    DELAY.ASM


    DELAYS_A SEGMENT CODE
    RSEG DELAYS_A
    DELAY10MICROSEC:
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    NOP
    RET
     
  2. TCOP

    Member

    Apr 27, 2011
    89
    0
    check your stack. you might have run out of it.
    better run it on a simulator to be 100% sure
     
  3. Meixner

    Member

    Sep 26, 2011
    116
    21
    Assuming you are using asm. you cannot stop the program with an END statement, the processor will continue executing through the entire program memory and wrap around to zero and loop over and over again.
     
Loading...