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

SPI interrupt at wrong address

I am using Atmel AT89C51CC03, and it is configured so in Keil too. The data sheet lists the SPI interrupt vector as 0x0053h, and I do define my interrupt as interrupt #10. However, the map file show my SPI interrupt has address of 0x0026h.

Does anyone know why is that? Anything I can do to make it right?

Thanks in advance!

Parents
  • This is the portion of map file:

    * * * * * * *   C O D E   M E M O R Y   * * * * * * *
    CODE    0000H     0003H     ABSOLUTE
    CODE    0003H     0003H     ABSOLUTE
    CODE    0006H     001CH     UNIT ?PR?_READ_EEPROM?NVMEM
    CODE    0022H     0001H     UNIT ?PR?DPSE_FORCE_INPUT_UPDATE?USER
    CODE    0023H     0003H     ABSOLUTE
    CODE    0026H     002BH     UNIT ?PR?SPICOMMISR?SPI_COMM
    CODE    0051H     0001H     UNIT ?PR?DPSE_START_C1?DPSE
    CODE    0052H     0001H     UNIT ?PR?DPSE_STOP_C1?DPSE
    CODE    0053H     0003H     ABSOLUTE
    CODE    0056H     0694H     UNIT         ?C?LIB_CODE
    CODE    06EAH     0549H     UNIT         ?CO?SPI_COMM
    

    The assembly code looks OK to me:

    ; FUNCTION SPICommISR (BEGIN)
    0000 C0E0              PUSH    ACC
    0002 C083              PUSH    DPH
    0004 C082              PUSH    DPL
    0006 63A201            XRL     AUXR1,#01H
    0009 C083              PUSH    DPH
    000B C082              PUSH    DPL
                                               ; SOURCE LINE # 469
                                               ; SOURCE LINE # 476
    000D E5D5              MOV     A,SPSCR
    000F 30E70B            JNB     ACC.7,?C0003
                                               ; SOURCE LINE # 477
                                               ; SOURCE LINE # 479
    0012 900000      R     MOV     DPTR,#tmpchar
    0015 E5D6              MOV     A,SPDAT
    0017 F0                MOVX    @DPTR,A
                                               ; SOURCE LINE # 480
    0018 75D6CC            MOV     SPDAT,#0CCH
                                               ; SOURCE LINE # 481
    001B B2C0              CPL     P4_0
                                               ; SOURCE LINE # 624
                                               ; SOURCE LINE # 625
    001D         ?C0003:
    001D D082              POP     DPL
    001F D083              POP     DPH
    0021 63A201            XRL     AUXR1,#01H
    0024 D082              POP     DPL
    0026 D083              POP     DPH
    0028 D0E0              POP     ACC
    002A 32                RETI
                 ; FUNCTION SPICommISR (END)
    

    I do have a line toggle I/O line (P4_0)inside interrupt for debugging purpose because it did not work the way I think. What I see on the scope is that
    the P4_0 toggles even when Chip Select is high. But I figure if the interrupt is at wrong place, anything could happen.

Reply
  • This is the portion of map file:

    * * * * * * *   C O D E   M E M O R Y   * * * * * * *
    CODE    0000H     0003H     ABSOLUTE
    CODE    0003H     0003H     ABSOLUTE
    CODE    0006H     001CH     UNIT ?PR?_READ_EEPROM?NVMEM
    CODE    0022H     0001H     UNIT ?PR?DPSE_FORCE_INPUT_UPDATE?USER
    CODE    0023H     0003H     ABSOLUTE
    CODE    0026H     002BH     UNIT ?PR?SPICOMMISR?SPI_COMM
    CODE    0051H     0001H     UNIT ?PR?DPSE_START_C1?DPSE
    CODE    0052H     0001H     UNIT ?PR?DPSE_STOP_C1?DPSE
    CODE    0053H     0003H     ABSOLUTE
    CODE    0056H     0694H     UNIT         ?C?LIB_CODE
    CODE    06EAH     0549H     UNIT         ?CO?SPI_COMM
    

    The assembly code looks OK to me:

    ; FUNCTION SPICommISR (BEGIN)
    0000 C0E0              PUSH    ACC
    0002 C083              PUSH    DPH
    0004 C082              PUSH    DPL
    0006 63A201            XRL     AUXR1,#01H
    0009 C083              PUSH    DPH
    000B C082              PUSH    DPL
                                               ; SOURCE LINE # 469
                                               ; SOURCE LINE # 476
    000D E5D5              MOV     A,SPSCR
    000F 30E70B            JNB     ACC.7,?C0003
                                               ; SOURCE LINE # 477
                                               ; SOURCE LINE # 479
    0012 900000      R     MOV     DPTR,#tmpchar
    0015 E5D6              MOV     A,SPDAT
    0017 F0                MOVX    @DPTR,A
                                               ; SOURCE LINE # 480
    0018 75D6CC            MOV     SPDAT,#0CCH
                                               ; SOURCE LINE # 481
    001B B2C0              CPL     P4_0
                                               ; SOURCE LINE # 624
                                               ; SOURCE LINE # 625
    001D         ?C0003:
    001D D082              POP     DPL
    001F D083              POP     DPH
    0021 63A201            XRL     AUXR1,#01H
    0024 D082              POP     DPL
    0026 D083              POP     DPH
    0028 D0E0              POP     ACC
    002A 32                RETI
                 ; FUNCTION SPICommISR (END)
    

    I do have a line toggle I/O line (P4_0)inside interrupt for debugging purpose because it did not work the way I think. What I see on the scope is that
    the P4_0 toggles even when Chip Select is high. But I figure if the interrupt is at wrong place, anything could happen.

Children