I can setup system configuration bits (fuses) in the MPLAB X project and/or in the code directly:
I understand that the ones on the Configutaion Bits
tab are stored in the project somewhere. Is that right? If yes, my questions is:
How do they relate to each other as they can be easily different?
Best Answer
As you stated it this is not correct.
The "Configuration Bits" tab is the way to describe how the configuration words for your PIC controller project need to be setup.
Once you have setup for configuration bits click on the "Generate Source Code to Output" button. Select the "Output - Config Bits Source" tab and cut and paste the content to just one your source code files.
The output is usually C language source code.
As you seem to be coding with PIC assembly for the dsPIC this gets a lot trickier.
This is an example for the dsPIC30F6015:
Note: You will need to change the
#include <xc.h>
statement to.include "xc.inc"
and change the C style#pragma config
statements to ASM styleconfig __REGISTER, SETTINGS
statements. Be sure that the names of the configuration bit registers have two_
underscore characters as a prefix.Important safety tip: The dsPIC assembler is invoked using the C compiler launcher. Your assembly files should use the
.s
file name extension. The IDE can be forced to use others but this will be the most convenient way to manage file names in your project.WARNING: The names of the configuration register bit fields in the part specific include
.inc
assembly file are not always the same as those the IDE knows about for C files. You may need to look in the.inc
file to see how they are defined.