IAP routine for P89V51RD2

Started by M.SH, April 12, 2005, 05:25:20 AM

Previous topic - Next topic

M.SH

Dear sir's.
I'm using a Philips P89C51RD2 chip that provides In-system Application Programming (IAP). I change them for P89v51rd2, however,
I can't  to use these routines for this device. What can I do?
please write correct code for me.
my written code:

in C file:
  IAP_Program_Data_Byte(0x55,0x4000)

in A51 file:
 PGM_MTP  EQU   1FF0H

        RSEG  ?PR?_IAP_Program_Data_Byte?IAP
_IAP_Program_Data_Byte:
        PUSH    IE                       ; disable interrupts
        CLR     EA;
        ANL     FCF,#0FEH         ;enable bootrom
       ; MOV     R0,IAP_Freq              ; osc frequency
        MOV     R1,#02H
        MOV     DPH,R4                   ; address to program
        MOV     DPL,R5
        MOV     A,R7                     ; data to write
        CALL    PGM_MTP                  ; call IAP routine
        MOV     R7,A                     ; save return value at R7
        ORL     FCF,#01H           ;disable bootrom
        POP     IE                       ; restore interrupts to initial state
        RET    
; end of IAP_Program_Data_Byte

thanck you.

Jan Waclawek

You have to make sure that the code switching to boot block (clearing FCF.0) and calling the PGM_MTP vector is ABOVE 2000h  - see datasheet.

But this question is in fact not related to FlashMagic, so better write to 8052.com next time.

Jan Waclawek

annietsai

Hi,
   I am working on P89V51RC2 and also have problem to make the IAP work.
-> calling the PGM_MTP vector is ABOVE 2000h.
May I ask you how to deal with this problem? The spec also mention that
avoid clearing BSEL when executing user code within the range 0000 to 1fffh.
However, I think for small testing program, the place to call IAP must be
inside this range. Do we have to do some extra work in main function
or IAP routine? Thank you so much.