0
\$\begingroup\$

I use MPLABX + XC8 with Proteus to simulate PIC designs.

It usually works fine...but I recently tried to use a 12F683 part and I get an MPLABX message "ERROR writing to CONFIG_MEM".

I think the problem is this: MPLABX creates a configuration word of 0xFF94 (for my desired operation) which it writes to the processor program memory at address 2007. But for some reason the Proteus 12F683 model won't allow any values above 0x3FFF for its configuration word.

I can't find any meaning for the high bits of the 12F683 configuration word in the Microchip docs, and 0x3F94 works with the Proteus model when not simulating through MPLABX.

So I'm asking one of two things:

  1. Has anybody figured out how to use MPLABX + Proteus to simulate a PIC 12F683 (or 12F675 or 12F1840, which have the same problem); OR...
  2. Does anybody know the correct pragma or instruction to have my program code write "0x3F94" to program memory location "2007" instead of the "0xFF94" that MPLABX writes using its #pragma config directives?
\$\endgroup\$
0
\$\begingroup\$

XC8 has a .cfgdata file for each MCU, which tells it how to format the config bits. Open the file 12f683.cfgdata in folder <xc8 path>\dat\cfgdata. You should find this:-

CWORD:2007:FFF:FFFF:CONFIG

Change the third parameter ('default value') from FFFF to 3FFF, and save the file. Clean and recompile your program and you should find the config word is now no larger than 0x3FFF.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the great info tidbit. I can't imagine how I'd ever figure that out on my own. Problem solved. \$\endgroup\$ – ChicoDaMan Sep 9 '17 at 6:23

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.