[go: up one dir, main page]

0% found this document useful (0 votes)
14 views2 pages

Assignment 01 Report - 22ug1-0819

dooor

Uploaded by

nipwimarshana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

Assignment 01 Report - 22ug1-0819

dooor

Uploaded by

nipwimarshana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment No 01

Project : LED Blink using PIC microcontroller

Module : EEE3305-Engineering Research (Embedded Systems) Project

Name : H.M.N.V Herath

Reg Number : 22ug1-0819

Faculty of Engineering (or Faculty of Technology)


Sri Lanka Technological Campu
Page 1 of 2
Add Simulated Circuit Diagram here

C main program (No need to add library codes)


#include <xc.h>

// PIC16F877A Configuration Bit Settings


// 'C' source line config statements
// CONFIG
#pragma config FOSC = EXTRC
#pragma config WDTE = OFF
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
#pragma config BOREN = OFF // Brown-out Reset Enable bit (BOR disabled)
#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
void main(void) {
TRISB=0x00;

while(1) {
PORTB=0x00000000;
__delay_ms(100);
PORTB=0x11111111;
__delay_ms(100);

}
return;
}
Explain the Operation of the Circuit

In this project, the PIC16F877A microcontroller serves as the central processing unit, executing programmed commands in
C language to control the LED. The LED is wired so that its positive terminal connects to one of the microcontroller's
digital output pins, while its negative terminal links to ground through a resistor to limit current flow and ensure safe
operation.
To keep accurate timing, a 16MHz crystal oscillator, along with 22pF capacitors, stabilizes the microcontroller's clock
signal, crucial for its functions. Ceramic capacitors are strategically placed for filtering out noise and providing clean
power, enhancing stability. Additionally, specific resistors are used for functions like pull-up or pull-down configurations
to set initial pin states as needed.
A steady 5V power supply ensures the microcontroller operates reliably within its specifications. Finally, a PIC
programmer such as PICkit3 is employed to upload custom code onto the microcontroller
Page 2 of 2

You might also like