SAFEraseBlock

Syntax:

    SAFEraseBlock ( block_number )

Command Availability:

Available on all PIC microcontrollers with SAFM memory.

Explanation:

SAFEraseBlock is used to erase all data locations within the SAFM block, setting SAFM data within the block to the erase-state value of the device.    This value is 0xFF for each location, and will read 0xFFFF if the program memory word is displayed. Use caution: once the SAFM block is erased, the SAFM data is gone forever and cannot be recovered unless it was previously saved.

The single parameter is as follows:

block_number represents the block to be erased.    The block_number parameter is used to calculate the physical memory location(s) that are updated.

Example 1:

Erase a specific block of SAFM.

    '... code preamble to select part
    '... code to setup PPS, if needed
    '... code to setup serial, if needed

    'Erase block 2 of SAFM
    SAFEraseBlock ( 2 )          ' <<< the SAFEraseBlock instruction

Key line: SAFEraseBlock ( 2 ) — erases every location in SAFM block 2, resetting it to 0xFF before new data is written with SAFWrite, SAFWriteWord, or SAFWriteBlock.

See Also: