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

Why does my program always start from C:0x00AE?

Dear all,

Thank you for your help in advance.

I created a very simple program to test my Monitor-51 which is showed below:

#include "AT89X55.H"

sbit P25 = 0xA5;

void DELAY(int j)
{
 int i;
 for(;j>0;j--)
  {
   for(i=2;i>0;i--)
    {;}
  }
}

main(){
while(1)
    {
    P25 = 0;
    DELAY(1);
    P25 = 1;
    DELAY(1);
    }
}

When I debugged this program by using Monitor-51,the first line is always "C:0x0000 0200AE LJMP c:00AE" in
the Disassembly window,and the other lines are:
...
C:0x00AE    E4       CLR      A
C:0x00AF    F5CB     MOV      RCAP2H(0xCB),A
C:0x00B1    F5CA     MOV      RCAP2L(0xCA),A
C:0x00B3    F5CC     MOV      TL2(0xCC),A
C:0x00B5    F5CD     MOV      TH2(0xCD),A
C:0x00B7    F5C9     MOV      T2MOD(0xC9),A
C:0x00B9    F5C8     MOV      T2CON(0xC8),A
C:0x00BB    20B0FD   JB       RXD(0xB0.0),C:00BB
C:0x00BE    30B0FD   JNB      RXD(0xB0.0),C:00BE
C:0x00C1    D2CA     SETB     TR2(0xC8.2)
C:0x00C3    30B003   JNB      RXD(0xB0.0),C:00C9
C:0x00C6    30CFFA   JNB      TF2(0xC8.7),C:00C3
C:0x00C9    30B0FD   JNB      RXD(0xB0.0),C:00C9
C:0x00CC    30B003   JNB      RXD(0xB0.0),C:00D2
C:0x00CF    30CFFA   JNB      TF2(0xC8.7),C:00CC
C:0x00D2    30B0FD   JNB      RXD(0xB0.0),C:00D2
C:0x00D5    C2CA     CLR      TR2(0xC8.2)
C:0x00D7    20CFD4   JB       TF2(0xC8.7),C:00AE
C:0x00DA    AFCC     MOV      R7,TL2(0xCC)
C:0x00DC    AECD     MOV      R6,TH2(0xCD)
C:0x00DE    EE       MOV      A,R6
C:0x00DF    C3       CLR      C
...
And I failed to change the statement by use of "Inline assembly".Why the assembly try to initial the timer2? I wonder if the MON51.HEX createad by INSTALL.A51 is fit to AT89S52? The MCU is AT89S52. I set the Option for target as follow: Off-chip code memory Start:0x8000, size:0x3fff, Off-chip Xdata memory Start:0xc000, size:0x3fff. When I use simulator to debug this program there is no problem. Can you give me a hand? Thanks.

Parents
  • The LJMP you see is where the reset vector jumps to the monitor program.

    If you program must start at address 0x8000 (when using the monitor) then you must do more than simply specifying the starting CODE address. Refer to the following knowledgebase article:

    http://www.keil.com/support/docs/189.htm

    Once the program downloads to the monitor, you may also have to specify the starting address ($ = 0x8000). It's probably a good idea to uncheck Go Til Mail in the debugger options.

    Jon

Reply
  • The LJMP you see is where the reset vector jumps to the monitor program.

    If you program must start at address 0x8000 (when using the monitor) then you must do more than simply specifying the starting CODE address. Refer to the following knowledgebase article:

    http://www.keil.com/support/docs/189.htm

    Once the program downloads to the monitor, you may also have to specify the starting address ($ = 0x8000). It's probably a good idea to uncheck Go Til Mail in the debugger options.

    Jon

Children