100% found this document useful (2 votes)
124 views

Study of Pic16F877A Microcontroller: Equipments Required

The document discusses studying the PIC16F877A microcontroller. It requires a development board, serial cable, and power adapter. It describes the PIC16F877A as an 8-bit microcontroller with features like FLASH memory, RAM, timers, analog to digital conversion, and communication interfaces. It provides details on the microcontroller's architecture, memory organization, registers, and peripheral features.

Uploaded by

Priyadharshini T
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
124 views

Study of Pic16F877A Microcontroller: Equipments Required

The document discusses studying the PIC16F877A microcontroller. It requires a development board, serial cable, and power adapter. It describes the PIC16F877A as an 8-bit microcontroller with features like FLASH memory, RAM, timers, analog to digital conversion, and communication interfaces. It provides details on the microcontroller's architecture, memory organization, registers, and peripheral features.

Uploaded by

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

STUDY OF PIC16F877A MICROCONTROLLER

AIM: To study about the PIC16F877A

EQUIPMENTS REQUIRED:
1. PIC16F877A DEVELOPMENT BOARD
2. SERIAL CABLE (RS232)
3. 5 V ADAPTER
4. CONNECTING WIRES

EMBEDDED SYSTEMS
An embedded system is a special-purpose computer system designed to perform one or a few
dedicated functions, often with real-time computing constraints. It is usually embedded as part
of a complete device including hardware and mechanical parts. In contrast, a general purpose
computer, such as a personal computer, can do many different tasks depending on
programming. Embedded systems control many of the common devices in use today

FEATURES OF EMBEDDED SYSTEMS

i. Cost
Micro controllers with the supplementary circuit components are much cheaper than a
computer with an analog and digital I/O.

ii. Size and Weight


Micro controllers are compact and light compared to computers.

iii. Simple applications


If the application requires very few number of I/O and the code is relatively small, which do not
require extended amount of memory and a simple LCD display is sufficient as a user interface,
a microcontroller would be suitable for this application.

iv. Reliability
Since the architecture is much simpler than a computer it is less likely to fail.
v. Speed
All the components on the microcontroller are located on a single piece of silicon. Hence, the
applications run much faster than it does on a computer.

HARDWARE DETAILS:
PIC 16F877 is a 40-pin 8-Bit CMOS FLASH Microcontroller from Microchip. The core
architecture is high-performance RISC CPU with only 35 single word1 instructions. Since it
follows the RISC architecture, all single cycle instructions take only one instruction cycle except
for program branches which take two cycles. 16F877 comes with 3 operating speeds with 4, 8,
or 20 MHz clock input. Since each instruction cycle takes four operating clock cycles, each
instruction takes 0.2 μs when 20MHz oscillator is used.
It has two types of internal memories: program memory and data memory. Program memory is
provided by 8K words (or 8K*14 bits) of FLASH Memory, and data memory has two sources.
One type of data memory is a 368-byte RAM (random access memory) and the other is 256-
byte EEPROM (Electrically erasable programmable ROM).
The core feature includes interrupt capability up to 14 sources, power saving SLEEP mode, and
single 5V In-Circuit Serial Programming (ICSP) capability. The sink/source current, which
indicates a driving power from I/O port, is high with 25mA. Power consumption is less than 2mA
in 5V operating condition.

The Peripheral Features:


(a) 3 time blocks: Timer0 for 8-bit timer/counter; Timer1 for 16-bit timer/counter; and Timer2: 8-
bit timer/counter with 8-bit period register, prescaler and postscaler.
(b) Two Capture, Compare, PWM modules for capturing, comparing 16-bit, and PWM
generation with 10-bit resolution.
(c) 10-bit multi-channel (max 8)Analog-to-Digital converter module.
(d) Synchronous Serial Port (SSP) with SPI (Master Mode) and I2C2 (Master/Slave)
(e) Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) with 9-bit address
detection.
(f) Parallel Slave Port (PSP) 8-bits wide, with external RD, WR and CS controls
(g) I/O ports.

Key Features of PIC16F877A:

FLASH Program Memory (14-bit WORD) 8K Words


Data Memory (RAM) 368 Bytes
Data Memory (EEPROM) 256 Bytes
Interrupts 14
I/O Ports A, B, C, D, E
Timers 3
Capture/Compare/PWM Modules 2
Serial Communications MSSP, USART
Parallel Communications PSP 10-bit
Analog-to-Digital Module 8 channels
Instruction Set 35 Instructions
PIN DIAGRAM and PACKAGE:

There are three package types are available: DIP, PLCC, and QFP. This book assumes that we all use the
DIP because of its best fit to breadboard or proto-board.

BLOCK DIAGRAM:
The internal schematic of PIC16F877 is illustrated in the following block diagram. In the block
diagram, we first see built-in function modules in boxes such as PORTA, PORTB for inputs and
outputs, a 10-bit Analog-to-Digital (AD) module, 3 timer modules (Timer 0, Timer 1, and Timer
EEPROM, etc.
Block Diagram of PIC16F877A

We also see the modules are connected via internal data bus of 8-bit width. This is the reason
why 16F877 is called an 8-bit microcontroller. Since the program memory (FLASH) is organized
with 14-bit word, it's content is accessed (or fetched) via 14-bit program bus by the instruction
register. Instruction registers are not in the file (RAM) area so is not accessible by program.
Another internal register, program counter (PC) accesses the program memory location
("addressing") via 13 bit information. With 13 bits, the addressing range goes to 2 13 =23 *210 =8K
word.
RAM file registers for data are connected via 8-bit data bus. The W register is a user accessible
register. As you see in the block diagram, W directly accesses the ALU and the 8-bit data bus.
As we can see, there should be W involved to move data between modules and inside the file
RAM, except via indirect addressing mode. This means that writing to the output ports is done
via the W register. The details of the indirect addressing are discussed in the PIC instruction.
PROGRAM MEMORY:
The PIC16F877 has a 13-bit program counter (PC) capable of addressing an 8K word of
program memory pace, and accessing a location above the physically implemented address will
cause a wrap-around. The reset vector is at address 0000 and the interrupt vector is at address
00043. Details of this will be discussed throughout the book as related subjects pop up.

DATA MEMORY (RAM):


The data memory in RAM is partitioned into multiple banks (or pages) which contain the
General Purpose Registers (GPR) and the Special Function Registers (SFR). The SFRs are
already internally defined by the system so users are not allowed to override these registers.
These are the main tools to utilize the built-in functions. In other words, assigning a port
(PORTA, PORTB, etc) or a pin of a port as input or output, for example, is done using one or
more of the SFRs. The GPRs are actually empty spaces to be used to store data or variables. In
other words, when you define a variable like, x, y, or temp, then you have to allocate a space (a
byte size) for each in the GPRs in RAM area. The registers in the RAM area are called file
registers. Each bank extends to 7Fh (128 bytes). The lower locations of each bank are reserved
for the SFRs. Above the SFRs are GPRs, implemented as static RAM. All implemented banks
contain SFRs. Some “high use” SFRs, such as STATUS register, PCL register, FSR register,
and INTCON register from one bank may be mirrored in another bank for code reduction and
quicker access. For example, the STATUS register presents at 0003h (bank 0), 0083h (bank 1),
0103h(bank 2), and 0183h(bank 3), simultaneously.
To access registers properly, the bank location of them must be selected. In other words, you
have keep track which bank of registers the CPU currently accesses. If the current bank access
is Bank0, and your next register is located in Bank1, you have to select the Bank1 before
accessing the register. The PIC CPU is very strict on the bank location. If we use an analogy of
word processing, when we want to select a word, we have to move the cursor around the word
then we click the mouse to select: without moving the cursor to the word, you do select the word
you intend to do, it would select any word near the current cursor position. The selection of a
bank is done by setting two bits of the STATUS register.

Let's examine the file register map briefly. As mentioned above, the fourth register (address
03h, 83h, 103h, and 183h) at each bank is assigned to STATUS register (see the Register file
map).
The STATUS register tells you about the status arithmetic and logical status. It also has very
important function of selecting a bank.

The detail of the STATUS register is shown below. Here, we highlight only bits of 6, 5, 2, and 0
of the register. Note that the bit number of the byte of the register starts from 0 ending at 7. As
we see, bits 5 and 6 of the register, as we indicate them as STATUS<6:5>, are RP1 and RP0
bits which select banks. In other words, for example, if you access a register in bank 3, you
have to set the two bits as 11, or STATUS<6:5>=11b4. In this selection, we change each bit of
a register. In such case, we may better use bit-oriented instruction (Details on instruction come
later). STATUS<2> is for Z flag to see if an operation results in zero or not.

Result:
Thus PIC16F877A Microcontroller was studied.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy