l. How the two-stage PIC24 and PIC32 flash RAM programming is done?

Programming executive (PE) is a special piece of program code that enables faster programming of PIC24 and PIC32 microcontrollers. First, PE is loaded into the SRAM of a microcontroller and then started. As PE takes control over the fast data register, flash RAM row data can be transmitted to SRAM with much less overhead. The next step is programming row data to flash RAM. It is accomplished by setting a special set of registers with a source (SRAM address), a destination address (flash RAM address) and a row programming command. The latter starts self-timed writing operations to program a row of data (32 bytes or 128 bytes, depending on the PIC32 subtype) to a flash RAM.

Alternatively, it is also possible to program a single 32-bit word at a time. First, the data has to be transferred to the PIC SRAM. This can also be done without using PE, with simple code language instruction transfer commands. Next, the data word has to be transferred from SRAM to flash RAM by setting a special set of microcontroller registers: the data register, the destination address register and the operation control register. This simple operation is particularly useful to setup configuration parameters to an already programmed chip.