Electronic – EEPROM and CONFIG macros on PIC with HI-TECH compiler

chi-tech-compilerpic

I have seen 2 lines of source code that I can't find documented anywhere. They are:

__CONFIG (0x03d4);
__EEPROM_DATA (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);

I assume that __EEPROM_DATA() writes data to the eeprom at address 00-07 in the source code above is this correct?

As for the __CONFIG() I don't understand why its a hexadecimal, typically it uses macros from the header files so what does it mean?

Best Answer

Your understanding of __EEPROM_DATA is correct. While it may be convention to use code such as the following to make code more readable (this is just an example, not a decode of the above):

__CONFIG(WDTDIS & HS);

The constants are just defined in an include file for the specific part. While not as readable the hex value 0x03d4 is valid and ends up in the configuration bits. In binary 0x03d4 is 0000001111010100 so you need to check the datasheet for the particular part in question to see what bits are being set.