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 Code starting location

I am using P89V51RD2, and I am coding in C.
I want my code to begin at address 0x2001. How can I do that with the help of C code?

Parents
  • Yes Bob you are right, I want to use IAP. But my problem is I just don't want my original code overwritten by IAP, which can program the chip from 0x0000 to 0x1fff. I want to write some data with IAP while the controller is accessing the user code and then use this data further in my program. Please don't get confused between data and RAM. I just want to write a few bytes to the controller flash with IAP making sure that my original flash memory code remains the same.

Reply
  • Yes Bob you are right, I want to use IAP. But my problem is I just don't want my original code overwritten by IAP, which can program the chip from 0x0000 to 0x1fff. I want to write some data with IAP while the controller is accessing the user code and then use this data further in my program. Please don't get confused between data and RAM. I just want to write a few bytes to the controller flash with IAP making sure that my original flash memory code remains the same.

Children
  • The IAP is located in a parallel memory page to your application. That memory page has a size of 8K bytes and shares the address space 0x0000 - 0x1fff. By setting the flash bank select and calling into the IAP you are permitting the IAP (running in its memory page) to perform any operation you request on any memory within your microprocessor.

    The key is making sure that you are not calling from an address that is in the parallel page address range. If your call is located in the overlaping address range, when you switch the flash bank bit, the next instruction executed will be from the IAP memory ... not your program.