Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/09/07 14:48
Modified:
  10/09/07 15:34

Read: times


 
#145547 - Here\'s the simplest program
Responding to: ???'s previous message
                 C_STARTUP:
C:0x0000    02232A   LJMP     STARTUP1(C:232A)

                 CALL_IAP_WRITE:
C:0x2300    C0A8     PUSH     IEN0(0xA8)
C:0x2302    C2AF     CLR      EA(0xA8.7)
                                  ;disable interrupts
C:0x2304    85D9F0   MOV      B(0xF0),CMOD(0xD9)
C:0x2307    AAF0     MOV      R2,B(0xF0)
                                  ;save CMOD contents and disable watchdog timer
C:0x2309    30F603   JNB      0xF0.6,IAPTAG11(C:230F)
C:0x230C    53D9BF   ANL      CMOD(0xD9),#0xBF
                 IAPTAG11:
C:0x230F    75E055   MOV      ACC(0xE0),#0x55
C:0x2312    758323   MOV      DPH(0x83),#0x23
C:0x2315    758270   MOV      DPL(0x82),#0x70
                                  ;data 55h to be stored at 2370h
C:0x2318    7902     MOV      R1,#0x02
                                  ;code to program data byte
C:0x231A    53B1FE   ANL      FCF(0xB1),#CCAP4H(0xFE)
                                  ;enable bootrom
C:0x231D    121FF0   LCALL    C:1FF0
                                  ;call IAP subroutine
C:0x2320    AFE0     MOV      R7,ACC(0xE0)
C:0x2322    43B101   ORL      FCF(0xB1),#0x01
                                  ;disable bootrom
C:0x2325    8AD9     MOV      CMOD(0xD9),R2
C:0x2327    D0A8     POP      IEN0(0xA8)
C:0x2329    22       RET      
                 STARTUP1:
C:0x232A    787F     MOV      R0,#0x7F
C:0x232C    E4       CLR      A
                 IDATALOOP:
C:0x232D    F6       MOV      @R0,A
C:0x232E    D8FD     DJNZ     R0,IDATALOOP(C:232D)
C:0x2330    758109   MOV      SP(0x81),#0x09
C:0x2333    022336   LJMP     main(C:2336)
                 main:
C:0x2336    122300   LCALL    CALL_IAP_WRITE(C:2300)
C:0x2339    750800   MOV      i(0x08),#0x00
                     ;had written in C as i = call_iap_write()
                     ;should returned value in R7 go to i?
C:0x233C    8F09     MOV      0x09,R7
C:0x233E    22       RET    



I generated the above code using the Disassembler in Keil-C compiler. The parts other than the IAP subroutine are the startup section and the main program that calls the IAP subroutine.

List of 9 messages in thread
TopicAuthorDate
IAP with the P89V51RD2            01/01/70 00:00      
   MOV ACC, 55H?            01/01/70 00:00      
      Change has no effect            01/01/70 00:00      
         post the relevant parts...            01/01/70 00:00      
            Here\'s the simplest program            01/01/70 00:00      
               how do you know this does not work?            01/01/70 00:00      
                  Displayed memory            01/01/70 00:00      
               I tried and here is the solution...            01/01/70 00:00      
   Works perfectly!            01/01/70 00:00      

Back to Subject List