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

IAP Langage C

Hello everybody.

I have a problem about writing the correct code to access the IAP routine in langage C, to write or read in the Flash memory of the microcontroleur P89V51RD2.

I know how doing this is assembleur like this :

For example this code allow to write the value 1 at the adress FFFFh of the flash memory. (This code works in assembleur).


MOV R1, #02h                                      //Write to the flash
MOV DPH, #0FFh                                    //at the adress FFFFh
MOV DPL, #0FFh
MOV A, #1                                         //value=1
MOV 0B1h, #0                                      //Enter in IAP
CALL 1FF0h
MOV 0B1h, #1                                      //Exit from IAP

But I don't know how to write "CALL 1FF0h" in C langage, and I don't want to insert asm code into a program write in langage C.

And Keil don't know "R1" in langage C, the message error is : error C202: 'R1": undefined identifier.

Do you have an idea?