2
\$\begingroup\$

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?

\$\endgroup\$
4
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Ahh This makes more sense. I've just read the datasheet and read the configuration bits. \$\endgroup\$ – Dean Jan 25 '13 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.