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
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
that will not work, unless the chip is in 12 clock mode. Are you sure it is
Erik
You might want to take a GOOD look at the data sheet. The API call is NOT compatible with the V51 chip.
This chip uses a special memory page for the IAP code and whose entry point is address 0x1ff0.
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