PIC microcontrollers have some special function registers configuration before main() function like oscillator type configuration, watch dog timer setting and many more. It's means these registers determine that what will be the conditions when controller will power up. if you do not take care, output file will not work.
We can set these registers in MPLAB IDE or in our codes. If you want to set these registers in codes, make sure "Configure" > Configuration Bits.. check box "Configure in codes" should be checked.
Setting configuration bits in IDE vs set in codes.
MPLAB IDE takes care that you can set configuration bits in codes or IDE window. you can not set some of bits in codes and some of in IDE. If you are changing the mode, you would be recompile your project after change the mode.
Configuration bits set in IDE :-
Configuration bits set in Codes :-
In the given above pictures both are the same bit configuration only is different is in fist picture we are setting configuration bits in IDE window and in the second picture we are writing codes for same configuration. When we compile our project, same hex file will generate in both cases.
No comments:
Post a Comment