00 Installation of MPLAB X IDE & XC8 Compiler
MPLAB installation
Download MPLAB X IDE and Install it.
Click here- https://www.microchip.com/mplab/mplab-x-ide
Download compiler XC8 and Install it.
Click here-https://www.microchip.com/en-us/development-tools-tools-and-software/mplab-xc-compilers
Example Code:-
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CONFIG | |
#pragma config FOSC = HS // Oscillator Selection bits (HS oscillator) | |
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled) | |
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled) | |
#pragma config BOREN = ON // Brown-out Reset Enable bit (BOR enabled) | |
#pragma config LVP = OFF // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3 is digital I/O, HV on MCLR must be used for programming) | |
#pragma config CPD = OFF // Data EEPROM Memory Code Protection bit (Data EEPROM code protection off) | |
#pragma config WRT = OFF // Flash Program Memory Write Enable bits (Write protection off; all program memory may be written to by EECON control) | |
#pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off) | |
// #pragma config statements should precede project file includes. | |
// Use project enums instead of #define for ON and OFF. | |
#include <xc.h> | |
#define _XTAL_FREQ 8000000 //Specify the XTAL crystall FREQ | |
void main() //The main function | |
{ | |
TRISD0= 0; //Instruct the MCU that the PORTB pins are used as Output. | |
RD0 = 0; //Make all output of RB3 LOW | |
while(1) //Get into the Infinie While loop | |
{ | |
RD0=1; //LED ON | |
__delay_ms(500); //Wait | |
RD0=0; //LED OFF | |
__delay_ms(500); //Wait | |
//Repeat. | |
} | |
} |
Click here to watch in details
Thanks for visiting💗
No comments: