DeviceConfigurationRead

Syntax:

    DeviceConfigurationRead (location, store)

Command Availability:

Available on all Microchip PIC microcontrollers with self-read capability. Not currently available on Atmel AVR.

Explanation:

DeviceConfigurationRead reads information from the device configuration area of memory on chips that support this feature — the area holding configuration words (fuses) such as oscillator selection, watchdog timer setup, and code-protection bits, rather than the general program-memory space that ProgramRead accesses. location and store are both word variables, meaning they can hold values greater than 255.

The range of location depends on the amount of configuration memory on the Microchip PIC microcontroller, given in the datasheet. store is 14 bits wide, and can therefore store values up to 16383.

This is an advanced command intended for developers who need to inspect a chip’s own configuration bits at run time; most programs never need to call it, since configuration is normally set once at compile time with #config.

Example:

    #chip 18F26K22, 16

    Dim ConfigLocation As Word
    Dim ConfigValue As Word

    ConfigLocation = 0x300000     ' start of the configuration word area on this chip

    DeviceConfigurationRead ( ConfigLocation, ConfigValue )          ' <<< the DeviceConfigurationRead instruction
    HSerPrint ConfigValue

Key line: DeviceConfigurationRead ( ConfigLocation, ConfigValue ) — reads the configuration word at ConfigLocation back into ConfigValue for inspection at run time.

See Also: