MICROPROCESSOR
MICROPROCESSOR
EXERCISES
MAYNARD PAGAUITAN
I. INTRODUCTION:
In the realm of microcontroller-based electronic systems, the PIC16F877A stands out as a
versatile and widely-used microcontroller, known for its reliability and functionality. One
common application of the PIC16F877A is in controlling and manipulating LED lights, a
fundamental aspect of embedded systems design. Simulation platforms like Proteus provide a
virtual environment for engineers and hobbyists to design, test, and validate their
microcontroller-based projects before actual hardware implementation.
This simulation project focuses on the manipulation of LED lights using the PIC16F877A
microcontroller within the Proteus environment. LEDs are popular components due to their low
power consumption, durability, and ease of interfacing with microcontrollers. Through this
simulation, users can gain hands-on experience in programming the PIC16F877A to control
LEDs and understand the underlying principles of digital electronics.
II. OBJECTIVES:
Gain proficiency in setting up the PIC16F877A microcontroller in the Proteus simulation
environment.
Configure essential hardware components, including oscillators, reset circuits, and power
supply, to create a stable microcontroller environment.
III. MATERIALS
MIKRO C
PROTEUS
- LED
- CRYSTAL OSCILLATOR
- CAPACITOR (22pF)
- PIC16F877A
IV. METHODS
Maynard Pagauitan Exercise 1
Description: The “LED Blinking Sequence with PIC16F877A” project on Circuit Digest
Void main() {
TRISB = 0x00;
PORTB = 0x00;
int counter = 0;
while (counter < 3) {
PORTB.RB7 = 1;
Delay_ms(1000);
PORTB.RB7 = 0;
PORTB.RB6 = 1;
Delay_ms(1000);
PORTB.RB6 = 0;
PORTB.RB5 = 1;
Delay_ms(1000);
PORTB.RB5 = 0;
PORTB.RB4 = 1;
Delay_ms(1000);
PORTB.RB4 = 0;
PORTB.RB3 = 1;
Delay_ms(1000);
PORTB.RB3 = 0;
PORTB.RB2 = 1;
Delay_ms(1000);
PORTB.RB2 = 0;
PORTB.RB1 = 1;
Delay_ms(1000);
PORTB.RB1 = 0;
PORTB.RB0 = 1;
Delay_ms(1000);
PORTB.RB0 = 0;
counter++;
}
}
Block diagram
Microcontroller
(MCU)
Maynard Pagauitan. Exercise 2
Description: This schematic uses an alternate light sequence that I created and
codedto light the LED. When you press the play button, the LED will turn on
automatically.The sequence shown in the picture is as follows: D1(LED1) turns on and off,
followed by D8(LED8), D2 (LED2), D7 (LED7), D3 LED3), D6 (LED6), D4
Code:void main()
{ TRISB =
0b00000000; // Set all PORTB pins
as output while(1) {
PORTB = 0b00000001;
Delay_ms(500);
// Adjust the delay as needed
PORTB = 0b10000000;
Delay_ms(500);
PORTB = 0b00000010;
Delay_ms(500);
PORTB = 0b01000000;
Delay
_ms(500);
PORTB = 0b00000100;
Delay_ms(500);
PORTB = 0b00100000;
Delay_ms(500);
PORTB = 0b00001000;
Delay_ms(500);
PORTB = 0b00010000;
Delay_ms(500);
}
}
IV. CONCLUSION
In conclusion, the LED lights manipulation simulation in Proteus was a valuable exercise in
understanding embedded systems and microcontroller programming. It allowed for the
integration of the PIC16F877A microcontroller with LED lights, demonstrating its ability to
control and manipulate LED states. The simulation also provided hands-on experience in coding
for the microcontroller, allowing for testing different configurations and scenarios. Proteus
proved to be an effective tool for visualizing and analyzing system behavior in a virtual
environment, offering a cost-effective and time-efficient means of prototyping and testing.