HEFWriteWord

Syntax:

    HEFWriteWord ( location, data_word_value )

Command Availability:

Available on all PIC micro-controllers with HEFM memory

Explanation:

HEFWriteWord is used to write information, word values, to HEFM, so that it can be accessed in a user program via the HEFReadWord command.

location represents the location or relative address to write. A data Word requires 2 HEF Locations, therefore the location will range from 0 to 126 in steps of 2.

data is the data that is to be written to the HEFM location.   This can be a word value or a word variable.

This method writes information to the HEFM given the specific location in the HEFM data storage . This method is similar to the methods for EEPROM but this method supports Word values.

Example 1:

    '... code preamble to select part
    '... code to setup serial

    'The following example stores a word value in HEFM location 0

    HEFWriteWord( 0, 0x1234)          ' <<< the HEFWriteWord instruction

Key line: HEFWriteWord( 0, 0x1234) — stores the 16-bit value 0x1234 at HEFM location 0.



Example 2:

    '... code preamble to select part
    '... code to setup serial

    'This example will write two word values to two specific locations.
    HEFWriteWord (16, 0xAA01)   ' <<< the HEFWriteWord instruction
    HEFWriteWord (18, 0xBB02)



If example 2 were displayed on a serial terminal.   The result would show, where -- is the existing value.

    Block0
    3F00   -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    3F10   01 AA 02 BB -- -- -- -- -- -- -- -- -- -- -- --
    3F20   -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    3F30   -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Key line: HEFWriteWord (16, 0xAA01) — stores the 16-bit value 0xAA01 at HEFM location 16; the terminal dump above shows the two written words (0xAA01, 0xBB02) laid out low-byte-first.



See Also: