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.

asked Apr 14, 2014 at 20:58
\$\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\$ Commented 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\$ Commented 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!

answered Apr 14, 2014 at 21:21
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.