This repository is a collection of tested example projects using Microchip’s mid-range PIC16F877A Microcontroller, programmed in mikroC and simulated in Proteus. These projects demonstrate various interfaces and external hardware components, providing a hands-on approach to learning embedded systems using the PIC16F877A.
- Step-by-step tutorials covering the fundamentals of PIC16F877A programming.
- Complete C codes written in mikroC.
- Proteus simulation files to visualize and verify circuits.
- Examples include working with external hardware such as:
- LEDs
- Seven-segment displays
- LCDs
- Keypads
- Motors (DC, stepper, etc.)
- Sensors (analog/digital)
PIC Micro | PIC16F877A | Proteus | PICKIT2
Before diving into the projects, you should have a basic understanding of the following topics:
- Binary and Hexadecimal Systems
- Digital Logic
- Basic Electronic Components (resistors, capacitors, transistors, etc.)
- PIC16F877A Architecture
- mikroC Basics: Familiarity with writing simple programs and compiling in mikroC.
- mikroC for PIC – Download mikroC IDE
- Proteus Design Suite – Download Proteus
- PICKIT2 Programmer – for uploading the compiled HEX file to your microcontroller.
The mikroC Integrated Development Environment (IDE) is designed for writing and compiling C code for various PIC microcontrollers. Here is a brief overview of its key features:
-
Project Manager: Organize your files and projects in the Project Manager window.
-
Compiler: Click on the "Build" button to compile your code and generate the HEX file.
-
Library Manager: Access ready-to-use libraries for various peripherals such as LCD, I2C, and UART.
Once the code is written, the mikroC compiler converts it into a HEX file, which can be loaded into the PIC microcontroller using the PICKIT2 Programmer or simulated in Proteus.
Proteus Design Suite is a powerful tool used to simulate circuits and embedded systems. It allows you to test your microcontroller-based designs virtually before implementing them on hardware.
- Schematic Capture: Design circuits using the Schematic Capture interface.
- Component Library: Select components like PIC16F877A, LCD, LEDs, etc., from the vast library.
- Microcontroller Simulation: Load the HEX file generated from mikroC into Proteus for testing.
- Virtual Oscilloscope & Debugging Tools: Use built-in tools to troubleshoot your circuits.
By using Proteus, you can design, simulate, and test circuits before physical prototyping and visualize how each project functions in real-time.
In each example, the PICKIT2 Programmer will be used to load the compiled HEX file into the PIC16F877A microcontroller.
- Connect the PICKIT2 to the PIC16F877A using ICSP pins.
- Open PICKIT2 Software.
- Select the correct microcontroller (PIC16F877A).
- Load the HEX file generated from mikroC.
- Click on Write to upload the program to the microcontroller.
Each project folder contains:
- Source Code (.c)
- Proteus Simulation File (.pdsprj)
- Schematic Diagram
- Components List
- Objective: Basic LED control using GPIO pins.
- Description: Introduction to microcontroller GPIO and basic delay function.
- External Hardware: LED, resistor.
- PICKIT2 Setup: Connect the programmer to the ICSP pins and upload the HEX file.
- Objective: Display digits on a 7-segment display.
- Description: Control single and multiple digits using multiplexing techniques.
- External Hardware: 7-segment display, resistors.
- PICKIT2 Setup: Load the program via PICKIT2 to control the display.
- Objective: Display text on a 16x2 LCD.
- Description: Learn how to send commands and data to an LCD module.
- External Hardware: 16x2 LCD, variable resistor for contrast control.
- PICKIT2 Setup: Program the PIC16F877A using PICKIT2 after code compilation.
- PIC16F877A Datasheet – Download here
- MikroC Reference Manual – MikroC Docs
- PICKIT2 User Guide – Download from Microchip
- GPIO Pins
- Timers and Interrupts
- Analog-to-Digital Conversion (ADC)
- PWM for motor control
Projects are visually represented with circuit diagrams, block diagrams, and simulation screenshots. Code sections are well-commented and follow a structured format to help both beginners and advanced users.
Example code snippet from the LED Blinking project:
void main() {
TRISB = 0x00; // Set PORTB as output
while(1) {
PORTB = 0xFF; // Turn ON LEDs
Delay_ms(500);
PORTB = 0x00; // Turn OFF LEDs
Delay_ms(500);
}
}
- Clone this repository:
git clone https://github.com/gmostofabd/PIC-Microcontroller-Projects.git
- Open the
.c
code files in mikroC. - Simulate the provided circuit diagrams using Proteus.
- Use PICKIT2 Programmer to load the compiled HEX file to your PIC16F877A microcontroller for hardware implementation.
This repository is licensed under the MIT License – see the LICENSE file for details.
For more tutorials and embedded systems content, follow me:
- GitHub: gmostofabd
- YouTube: Embedded Systems & IoT Tutorials
- LinkedIn: Professional Profile
- Microchip’s PIC Microcontrollers – C Programming Course: Udemy Course
- Embedded Systems with PIC Microcontroller: Book Reference
- Proteus Simulation for Embedded Systems: Proteus Forum