1
\$\begingroup\$

I'm debugging and want to inspect

CONFIG1H (CONFIGURATION REGISTER 1 HIGH)

of a PIC18F. CONFIG1H does seem to be recongized as an SFR when I enter it into the Watch window.

After stopping at a breakpoint, you can open the configuration bits window:

Window >> PIC Memory Views >> Configuration bits

but it's unclear whether those are cached in MPLABX or newly read from the MCU.

\$\endgroup\$
2
  • \$\begingroup\$ These config registers are special, and not directly accessible in the same way as sfr's. Do you have the source code and/or source hex file available? Or are you reading out the code from the PIC? \$\endgroup\$
    – bitsmack
    Apr 14, 2014 at 21:03
  • \$\begingroup\$ Yes. I'm mucking with configuration register and OSCCON settings for low speed USB but can only seem to get things working for the default full speed settings \$\endgroup\$
    – tarabyte
    Apr 14, 2014 at 21:06

1 Answer 1

0
\$\begingroup\$

To avoid this ambiguity, you should embed the CONFIG register settings in your source code. Then, when you compile your code, it embeds the settings into your hex file.

As you stated, you can view the Configuration Bits. This is not to set them, however, as much as to assist you in formatting them for your code. Once you select what you want, click where it says "Generate Source Code":

config

It will give you formatted #pragma statements that you can copy directly into your source files:

code

Put these statements in the source code, outside of any function. I put mine at the top of my main.c file.

Good luck!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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