PFMWrite

Syntax:

    PFMWrite (location, value)

Command Availability:

Available on Microchip PIC microcontrollers with PFM (Program Flash Memory) self-write capability, such as the 18FxxQ41 family.

Explanation:

PFMWrite writes information to the program memory on chips that support this feature. location is a word variable identifying the word to write, and value is the word value to store there.

The largest value possible for location depends on the amount of program memory on the microcontroller.

This is an advanced command intended for developers who need direct control over program-memory self-write operations; most programs should use DATA blocks instead. As with ProgramWrite, the target row must normally be erased before it can be written — consult the chip’s datasheet for the row size and any required unlock sequence.

Example:

    #chip 18F56Q43, 64

    Dim WordLocation As Word

    WordLocation = 0x1000

    PFMWrite ( WordLocation, 0x1234 )          ' <<< the PFMWrite instruction

Key line: PFMWrite ( WordLocation, 0x1234 ) — stores the 16-bit value 0x1234 at the program-memory word addressed by WordLocation.

See Also:

  • PFMRead — reading back the value this page writes
  • ProgramWrite — the equivalent command on chip families that do not use the PFM naming
  • DATA — defining a program-memory dataset instead of writing individual words