Summer 2 Task 1 Embedded

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Name: Yassin Ahmad Nasr

Task 1

A) Discribtion of all the pins of PIC16F877A:


1- MCLR/Vpp: MCLR is used during programming, mostly connected to programmer like PicKit.
2- RA0/AN0: Analog pin 0 or 0th pin of PORTA.
3- RA1/AN1: Analog pin 1 or 1th pin of PORTA.
4- RA2/AN2/Vref-: Analog pin 2, 2th pin of PORTA or negative voltage reference.
5- RA3/AN3/Vref+: Analog pin 3, 3th pin of PORTA or positive voltage reference.
6- RA4/T0CKl.C1out: Digital pin no4 of PORTA.
7- RA5/AN4/SS/C2out: Analog pin 4 or 5th pin of PORTA.
8- RE0/RD/AN5: Analog pin 5 or 0th pin of PORTE.
9- RE1/WR/AN6: Analog pin 6 or 1st pin of PORTE.
10- RE2/CS/AN7: Analog pin 7 or 2st pin of PORTE.
11- Vdd: Ground pin of MCU.
12- Vss: Positive pin of MCU (+5V).
13- OSC1/CLKI: External oscillator/clock input pin.
14- OSC2/CLKO: External oscillator/clock output pin.
15- RC0/T1OSO/T1CKI: Digital pin 0 of PORTC.
16- RC1/T1OSI/CCP2: Digital pin 1 of POCTC or Timer/PWM pin.
17- RC2/CCP1: Digital pin 2 of POCTC or Timer/PWM pin.
18- RC3/SCK/SCL: Digital pin 3 of POCTC.
19- RD0/PSP0: Digital pin 0 of POCTD or Parallel Slave Port data bit 0.
20- RD1/PSP1: Digital pin 1 of POCTD or Parallel Slave Port data bit 1.
21- RD2/PSP2: Digital pin 2 of POCTD or Parallel Slave Port data bit 2.
22- RD3/PSP3: Digital pin 3 of POCTD or Parallel Slave Port data bit 3.
23- RC4/SDI/SDA: Digital pin 4 of POCTC or serial data input pin.
24- RC5/SDO: Digital pin 5 of POCTC or serial data output pin.
25- RC6/Tx/CK: Digital pin 6 of POCTC or Transmitter pin of the MC.
26- RC7/Rx/DT: Digital pin 7 of POCTC or Receiver pin of the MC.
27- RD4/PSP4: Digital pin 4 of POCTD or Parallel Slave Port data bit 4.
28- RD5/PSP5: Digital pin 5 of POCTD or Parallel Slave Port data bit 5.
29- RD6/PSP6: Digital pin 6 of POCTD or Parallel Slave Port data bit 6.
30- RD7/PSP7: Digital pin 7 of POCTD or Parallel Slave Port data bit 7.
31- Vss: Positive pin of MCU (+5V).
32- Vdd: Ground pin of MCU.
33- RB0/INT: Digital pin 0 of POCTB or External interrupt pin.
34- RB1: Digital pin 1 of POCTB.
35- RB2: Digital pin 2 of POCTB.
36- RB3/PGM: Digital pin 3 of POCTB or connected to programmer.
37- RB4: Digital pin 4 of POCTB.
38- RB5: Digital pin 5 of POCTB.
39- RB6/PGC: Digital pin 6 of POCTB or connected to programmer.
40- RB7/PGD: Digital pin 7 of POCTB or connected to programmer.

B) Functions of the main blocks in Pic16F877A:

1-ALU: It’s a digital circuit that performs arithmetic and bitwise operations on integer binary
numbers. It is responsible for performing arithmetic operations such as addition, subtraction,
multiplication, and division.

2-Status and Control: It’s an eight-bit register that contains the arithmetic status of the ALU, the
reset status, and the bank select bits from the data memory.

3-Program Counter: It’s a 13-bit wide register that’s capable of addressing 8K*14 bit program
memory space. It executes stored commands one by one.

4-Flash Memory Program: It’s used to store programs that are written by the user. These devices
have 8K*14 bits of flash memory that can be electrically erasable.

5-Instruction Register: It holds the instruction being executed by the micro controller.

6-Instruction Decoder: It decodes the instruction held in the instruction register and generates
control signals to execute it.

C) Why is a led connected to RA4 for flashing purpose not working properly?

Because RA4 is an open drain output, unlike the other digital pins in the MC, so, when set at low,
the output is low, but when set at high, the output will be tristated (high impedance). The LED’s
configuration needs to be changed to turn on with an open drain.

D) ATMega328P VS PIC16F877A:
1-Memory Size: The ATMega328P has 32KB of flash memory, 1KB of EEPROM, and 2KB of
SRAM. The PIC16f877A has 14KB of flash memory, 256 bytes of EEPROM, and 368 bytes of SRAM.

2-Power Consumption: The ATMega328P has a lower power consumption than the PIC16f877A. It
has a power consumption of 0.2mA/MHz at 1.8V and 1MHz3. The PIC16f877A has a power
consumption of 5mA/MHz at 5V and 20MHz2

3-Pin Count: The ATMega328P has 28 pins, while the PIC16f877A has 40 pins.
Conclusion: the ATMega328P is a better choice for applications that require low power
consumption and small memory size.

Applications in which the ATMega328P is a better choice:


Smartwatches: require low power consumption to extend battery life. The ATMega328P
is a better choice than the PIC16f877A because it has lower power consumption and
smaller memory size.

Remote Sensors: Remote sensors require low power consumption to extend battery life.
The ATMega328P is a better choice than the PIC16f877A because it has lower power
consumption and smaller memory size.

You might also like