Pic microcontroller code Mplab ide
In simple MPLAB IDE I am manually setting the configuration bits in the configuration window and after compiling the code with c18 compiler i am exporting the hex file containing the configuration bit code. Note that the output compiled code hex file in MPLAB ide does not contains the config info. For proper config bits hex file, you have to import it from the file>Import-Hex.
The code in MPLABX contains the fuses bits included in it so the hex file generated in this case contains the config bit info in it. We don’t need to export file from any other window feature.
Pic18 microcontroller blink led – Project circuit
Configuration bits settings for pic microcontroller in mplab ide
You have to set PLLDIV, CPUDIV and USBPLL configuration bits correctly which matches to the crystal frequency you are using. Configuration settings are given below.
Pic18 microcontroller mplab ide code
TRISAbits.XXX command is used to initialize the individual pins of pic microcontroller in mplab ide as input or output. PORTAbits.XXX command is used to write to individual microcontroller pins in mplab ide. We can directly initialize the whole port by accessing the whole TRISA register simply by TRISA=input/output. Same as we can write to whole port at once by PORTA=high/low.
Pic microcontroller code in mplabx ide
Filed Under: Microcontroller Projects, PIC Microcontroller