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

P89V51RD2 - IAP can't do it..

I am trying to work with the IAP for P89V51RD2.
I just tried to check the following code which I expect to
program the memory location 0x0020 with 01h.
I am using a clock=40 Mhz and am stroring that value in R0. But the code is not working. ie when I try to read memory from Flash Magic, I do not see any change at 0x0020
Can anyone fix the problem??

code is:

        ORG 00

                        MOV   DPH,#00h
                        MOV   DPL,#20h
                        MOV   A,#1h
                        MOV   R0,#40
                        MOV   R1,#02H
                        CALL  0FFF0H


                        END

Parents Reply Children
  • No guys.. I got it working..
    It is surely not the case that frq should be 12MHz neither is it necessary to have C51 chip..
    The code is

     org 02100h
    
             PUSH    IE          ;DISABLE INTERRUPTS
             CLR     EA
                     MOV     A, 0B1h
             ANL     A,#0FCh   ;enable boot sector - !!! this command MUST be located ABOVE 2000h!!!
             MOV     0B1h, A
                     MOV   A,#1h
                     CALL    01FF0H      ;call to ISP_API (modifies B register but no Rx)
    
                     MOV   DPH,#00h
             MOV   DPL,#00h
    
    
                            MOV   R1,#02H        ; function code
                     MOV     A, 0B1h
                     ORL     A,#001h   ;switch back to user FLASH
                     MOV     0B1h, A
             POP     IE
    END