Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

MPLAB Tutorial – Hi-Tech C Programming (Programming a microcontroller)

1. Open MPLAB IDE by selecting [Start -> All Toolsuite’, check the checkbox ‘Show all
Programs -> Microchip -> MPLAB IDE v8.70 -> installed toolsuites in the bottom right).
MPLAB IDE]
2. In the MPLAB IDE toolbar, select [Project ->
Project Wizard...]

6. Use the [Browse] button and navigate to a


new folder to store this project and click
[Next>] to continue
3. Click [Next>] to proceed at Welcome dialog
box

7. Click [Finish] to exit the Project Wizard


4. Select the [PIC16F877] from the Device
menu and click [Next>] to continue

5. Select the [HI TECH Universal 8. The MPLAB IDE Workspace should now be
ToolSuite] from the Active Toolsuite drop open.
down menu and click [Next>] to continue (If
‘Hi-TECH Universal Toolsuite’ is not in the ‘Active

Tutor: Latha Karthigaa Murugesan Page 1


9. Create a C file. File -> New. New file would 12. Connect the microcontroller kit to the
open. Save the file as sample.c computer using USB cable and connect the
10. Type the following program in the new file programmer to the kit.
and save it.
13. Click Programmer -> Select Programmer ->
PICKit 2
#include <htc.h>
__CONFIG (LVP_OFF & WDTE_OFF & CP_OFF &
MCLRE_OFF);
//__CONFIG (LVPDIS & WDTDIS & UNPROTECT &
MCLRDIS);
void main ()
{
 ANSEL= 0x0; 
 ANSELH= 0x0;
 TRISB= 0x0;
 PORTB= ~0b11111111; 
}

11. In the configure window, right click ‘Source


Files’ -> ‘Add Files…’ and add the file sample.c 14. Click to build the project.
15. Click the button marked below to write the
program on to the device. Output could be viewed
in the microcontroller kit.

Tutor: Latha Karthigaa Murugesan Page 2

You might also like