5.2.5 ID Locations

The 8-bit PIC devices have locations outside the addressable memory area that can be used for storing program information, such as an ID number. The config pragma is also used to place data into these locations by using a special register name. The pragma is used as follows:

#pragma config IDLOCx = value

where x is the number (position) of the ID location, and value is the nibble or byte that is to be positioned into that ID location. The value can only be specified in decimal or in hexadecimal, the latter radix indicated by the usual 0x prefix. Values must never be specified in binary (i.e., using the 0b prefix). If value is larger than the maximum value allowable for each location on the target device, the value will be truncated and a warning message is issued. The size of each ID location varies from device to device. See your device data sheet for more information. For example:

#pragma config IDLOC0 = 1
#pragma config IDLOC1 = 4

will attempt fill the first two ID locations with 1 and 4. One pragma can be used to program several locations by separating each register-value pair with a comma. For example, the above could also be specified as shown below.

#pragma config IDLOC0 = 1, IDLOC1 = 4

The config pragma does not produce executable code and so should ideally be placed outside function definitions.