Microchip Technology PICkit 3 Debug Express Debugger/Programmer (DV164131) PICkit 3 Debug Express DV164131 Fiche De Données
Codes de produits
DV164131
PICkit™ 3 Debug Express
DS41370C-page 64
© 2009 Microchip Technology Inc.
When the 32 locations are written with the pointer, they are not actually written to
program until the completion of the entire sequence. The pointer writes actually store
the data in 32 temporary hardware registers. When the actual write sequence is
executed, it is the contents of this 32-byte buffer that is written to the program memory
array. For example, we might use a for loop to write the contents of a RAM array to
these buffers using a ROM pointer.
program until the completion of the entire sequence. The pointer writes actually store
the data in 32 temporary hardware registers. When the actual write sequence is
executed, it is the contents of this 32-byte buffer that is written to the program memory
array. For example, we might use a for loop to write the contents of a RAM array to
these buffers using a ROM pointer.
for (i = 0; i < 32; i++)
{
*(rom_pointer + i) = ram_array[i];// write to the holding registers
}
This data is not actually in program memory yet, and won’t be until the entire write
sequence is completed as shown in Figure 3-51.
sequence is completed as shown in Figure 3-51.
As an example for the above note, suppose using the following code we intended to
write to the 32 block of program memory from address 0x100 to 0x11F. The data would
actually be written to address 0x120 because the pointer is incremented to address
0x120 after the last write.
write to the 32 block of program memory from address 0x100 to 0x11F. The data would
actually be written to address 0x120 because the pointer is incremented to address
0x120 after the last write.
rom_pointer = (near rom unsigned char *)0x100;
for (i = 0; i < 32; i++)
{
*(rom_pointer++) = ram_array[i]; // write to the holding registers
}
// after the for loop, the rom_pointer address value is 0x120.
If the rom_pointer value were left at 0x11F, the data would be written as intended
started at 0x100.
started at 0x100.
Note:
The program memory block that is written to is determined by the address
in the TBLPTRU:TBLPTRH:TBLPRTL Special Function Registers, exclud-
ing the 5 Least Significant bits. These bits are excluded to ensure the write
block begins on a 32-byte boundary. Therefore, it is critically important
that the pointer address is not
in the TBLPTRU:TBLPTRH:TBLPRTL Special Function Registers, exclud-
ing the 5 Least Significant bits. These bits are excluded to ensure the write
block begins on a 32-byte boundary. Therefore, it is critically important
that the pointer address is not
incremented past the last address in
the block.
If this occurs, the 32 bytes will be written at the next block
boundary instead of the intended one.