Syntax:
ProgramErase (location)Command Availability:
Available on all Microchip PIC microcontrollers with self write capability. Not available on Atmel AVR at present.
Explanation:
ProgramErase erases information from the program memory on chips that support this feature. The largest value possible for location depends on the amount of program memory on the Microchip PIC microcontroller, which is given on the datasheet.
This command must be called before writing to a block of memory. It is slow in comparison to other GCBASIC commands.
Note that it erases memory in blocks/pages — the size varies by device: - Many classic PIC18F devices: typically 64 bytes (32 words) per erase row. - Newer PIC18 Q-series (e.g., PIC18FxxQ43, PIC18FxxQ84): typically 256 bytes (128 words) per erase page. - Other sizes exist on some models (e.g., 512 bytes or larger on certain variants).
Always consult the relevant Microchip PIC microcontroller datasheet for the exact erase page/row size, required alignment (usually multiples of the page size), and any restrictions on self-write/erase operations (e.g., unlock sequences, row vs. page erase).
Care must be taken with this command, as it can easily erase the program that is running on the microcontroller.
For more help, see ProgramRead and ProgramWrite

