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 11:04
Modified:
  10/09/07 12:51

Read: times


 
#145532 - IAP with the P89V51RD2
I am trying to perform the In-Application Programming of the P89V51RD2. I have written this section of code for the program(modifying one that I found for the P89C51RD2) but it doesn't seem to be working at all. The code is just meant to test whether the IAP is functioning or not and hence, the loading of ACC and DPTR within the subroutine.

call_iap_write:
	PUSH    IEN0                     ;disable interrupts
        CLR     EA
        MOV     B,CMOD
        MOV     R2,B                     ; store copy of CMOD
        JNB     B.6,?IAPTAG11            ; if watchdog enabled then disable
	ANL 	CMOD,#0BFH
?IAPTAG11:
	MOV	ACC, #55H
	MOV	DPH, #23H
	MOV 	DPL, #70H
	MOV     R1, #02H
	ANL 	FCF, #0FEH              ; enable bootrom
        CALL    01FF0H                   ; call iap routine
	MOV 	R7, ACC
        ORL	FCF,#01H		 ; disable bootrom
        MOV     CMOD,R2                  ; restore CMOD (restore watchdog state)
        POP     IEN0                     ; restore interrupts to initial state
        RET  


I have ensured that this code is well beyond 1FFFH i.e. the part of memory that the bootloader will occupy.

Can anyone please help?

Edit: Changed the ACC and DPTR contents according to what Jan said below

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