0% found this document useful (0 votes)
182 views

Embedded System Notes

The document discusses embedded systems and provides details about their characteristics, components, and applications. It defines embedded systems as single-purpose, tightly constrained systems that must react in real-time. Typical embedded systems are microprocessor or microcontroller-based and have memory, peripherals, and both hardware and software components. Common applications include devices like microwaves, remote controls, and car components.

Uploaded by

Chetna
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
182 views

Embedded System Notes

The document discusses embedded systems and provides details about their characteristics, components, and applications. It defines embedded systems as single-purpose, tightly constrained systems that must react in real-time. Typical embedded systems are microprocessor or microcontroller-based and have memory, peripherals, and both hardware and software components. Common applications include devices like microwaves, remote controls, and car components.

Uploaded by

Chetna
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 66

Overview of Embedded System 

Characteristics of Embedded System 


 
● Single-functioned − An embedded system usually performs a specialized
operation and does the same repeatedly. For example: A pager always
functions as a pager.
● Tightly constrained − All computing systems have constraints on design
metrics, but those on an embedded system can be especially tight. Design
metrics is a measure of an implementation's features such as its cost, size,
power, and performance. It must be of a size to fit on a single chip, must
perform fast enough to process data in real time and consume minimum
power to extend battery life.
● Reactive and Real time − Many embedded systems must continually react
to changes in the system's environment and must compute certain results in
real time without any delay. Consider an example of a car cruise controller; it
continually monitors and reacts to speed and brake sensors. It must compute
acceleration or de-accelerations repeatedly within a limited time; a delayed
computation can result in failure to control of the car.
● Microprocessors based − It must be microprocessor or microcontroller
based.
● Memory − It must have a memory, as its software usually embeds in ROM.
It does not need any secondary memories in the computer.
● Connected − It must have connected peripherals to connect input and output
devices.
● HW-SW systems − Software is used for more features and flexibility.
Hardware is used for performance and security.

Block Diagram of Embedded System 


 

 
 
Applications of Embedded System

In Notes

General Purpose Computer

A ​general​-​purpose computer is one that, given the appropriate application and


required time, should be able to perform most common ​computing tasks. Personal
computers​, including desktops, notebooks, smartphones and tablets, are all examples
of ​general​-​purpose computers​.

Comparison between Embedded System and 


General Purpose Computer

General Purpose Computer Embedded Systems

It is designed using a microprocessor It is mostly designed using a


as the main processing unit. microcontroller as the main processing
unit.

It contains a large memory It uses semiconductor memories,but


semiconductor memories like cache does not require secondary memories
and RAM. it also contains secondary like hard disk,CD.lt sometime has
storage like hard disks etc. special memory called flash memory.
It is designed such that it can cater to It is designed such that it can cater to a
multiple tasks as per requirement. particular predefined task.

It is mostly costlier compared to the It is cheaper compared to a computer.


embedded systems

It requires huge number of peripheral It is cheaper as it requires less no of


devices and their controllers peripheral devices and their controllers
are microcontroller chip itself.

The Operating system and other The operating system(mostly RTOS i.e
software for the general purpose Real Time Operating System) and other
computers, are normally complicated software occupy less memory space.
and occupy more memory space

Microprocessor

Microprocessor is a controlling unit of a micro-computer, fabricated on a small chip


capable of performing ALU (Arithmetic Logical Unit) operations and communicating
with the other devices connected to it.

Microprocessor consists of an ALU, register array, and a control unit. ALU performs
arithmetical and logical operations on the data received from the memory or an input
device. Register array consists of registers identified by letters like B, C, D, E, H, L and
accumulator. The control unit controls the flow of data and instructions within the
computer.
Block Diagram of a Basic Microcomputer

Microcontroller

A microcontroller is a small and low-cost microcomputer, which is designed to perform


the specific tasks of embedded systems like displaying microwave’s information,
receiving remote signals, etc.

The general microcontroller consists of the processor, the memory (RAM, ROM,
EPROM), Serial ports, peripherals (timers, counters), etc.

Microprocessor Architecture and Function

1) A microcontroller basically contains one or more following components:

● Central processing unit(CPU)


● Random Access Memory)(RAM)
● Read Only Memory(ROM)
● Input/output ports
● Timers and Counters
● Interrupt Controls
● Analog to digital converters
● Digital analog converters
● Serial interfacing ports
● Oscillatory circuits

2) A microcontroller internally consists of all features required for a computing system


and functions as a computer without adding any external digital parts in it.

3) Most of the pins in the microcontroller chip can be made programmable by the
user.

4) A microcontroller has many bit handling instructions that can be easily


understood by the programmer.

5) A microcontroller is capable of handling Boolean functions.

6) Higher speed and performance.

7) On-chip ROM structure in a microcontroller provides better firmware security.

8 ) Easy to design with low cost and small size.

Microcontroller structure

The basic structure and block diagram of a microcontroller is shown in the fig
(1.1).
Microcontroller Structure

Image Taken From

● CPU

CPU is the brain of a microcontroller. CPU is responsible for fetching the


instruction, decodes it, then finally executed. CPU connects every part of a
microcontroller into a single system. The primary function of CPU is fetching and
decoding instructions. The instruction fetched from program memory must be
decoded by the CPU.
● Memory

The function of memory in a microcontroller is the same as a microprocessor. It


is used to store data and program. A microcontroller usually has a certain
amount of RAM and ROM (EEPROM, EPROM, etc) or flash memories for storing
program source codes.

● Parallel input/output ports

Parallel input/output ports are mainly used to drive/interface various devices such
as LCD’S, LED’S, printers, memories, etc to a microcontroller.

● Serial ports

Serial ports provide various serial interfaces between a microcontroller and other
peripherals like parallel ports.

● Timers/counters

This is the one of the useful function of a microcontroller. A microcontroller may


have more than one timer and counters. The timers and counters provide all
timing and counting functions inside the microcontroller. The major operations of
this section are performed clock functions, modulations, pulse generations,
frequency measuring, making oscillations, etc. This also can be used for counting
external pulses.

● Analog to Digital Converter (ADC)

ADC converters are used for converting the analog signal to digital form. The
input signal in this converter should be in analog form (e.g. sensor output) and
the output from this unit is in digital form. The digital output can be used for
various digital applications (e.g. measurement devices).

● Digital to Analog Converter (DAC)

DAC perform reversal operation of ADC conversion.DAC converts the digital


signal into analog format. It usually used for controlling analog devices like DC
motors, various drives, etc.

● Interrupt control

The interrupt control used for providing interrupt (delay) for a working program.
The interrupt may be external (activated by using interrupt pin) or internal (by
using interrupt instruction during programming).
● Special functioning block

Some microcontrollers used only for some special applications (e.g. space
systems and robotics) these controllers containing additional ports to perform
such special operations. This considered as special functioning block.

Difference  between  Microprocessor  and 


Microcontroller

The following table highlights the differences between a microprocessor and a


microcontroller −

Microcontroller Microprocessor

Microcontrollers are used to Microprocessors are used for big


execute a single task within an applications.
application.

Its designing and hardware cost is Its designing and hardware cost is high.
low.

Easy to replace. Not so easy to replace.

It is built with CMOS technology, Its power consumption is high because it


which requires less power to has to control the entire system.
operate.
It consists of CPU, RAM, ROM, It doesn’t consist of RAM, ROM, I/O ports. It
I/O ports. uses its pins to interface to peripheral
devices.

Microprocessors Microcontrollers

It is only a general purpose


1 It is a microcomputer itself
computer CPU

Memory, I/O ports, timers,


All are integrated inside the
2 interrupts are not available
microcontroller chip
inside the chip

This must have many


Can function as a microcomputer without
3 additional digital components
any additional components.
to perform its operation

Systems become bulkier and Make the system simple, economic and
4
expensive. compact
Not capable for handling
5 Handling Boolean functions
Boolean functions

6 Higher accessing time required Low accessing time

Very few pins are


7 Most of the pins are programmable
programmable

Very few number of bit


8 Many bit handling instructions
handling instructions

Widely Used in modern PC


9 widely in small control systems
and laptops

INTEL 8086,INTEL Pentium INTEL8051,89960,PIC16F877


E.g.
series
Types of Microcontroller
Microcontrollers are divided into various categories based on memory, architecture,
bits and instruction sets. Following is the list of their types −

Bit

Based on bit configuration, the microcontroller is further divided into three categories.

● 8-bit microcontroller − This type of microcontroller is used to execute arithmetic


and logical operations like addition, subtraction, multiplication division, etc. For
example, Intel 8031 and 8051 are 8 bits microcontroller.
● 16-bit microcontroller − This type of microcontroller is used to perform arithmetic
and logical operations where higher accuracy and performance is required. For
example, Intel 8096 is a 16-bit microcontroller.
● 32-bit microcontroller − This type of microcontroller is generally used in
automatically controlled appliances like automatic operational machines, medical
appliances, etc.

Memory

Based on the memory configuration, the microcontroller is further divided into two
categories.

● External memory microcontroller − This type of microcontroller is designed in


such a way that they do not have a program memory on the chip. Hence, it is
named as external memory microcontroller. For example: Intel 8031
microcontroller.
● Embedded memory microcontroller − This type of microcontroller is designed in
such a way that the microcontroller has all programs and data memory, counters
and timers, interrupts, I/O ports are embedded on the chip. For example: Intel
8051 microcontroller.

Instruction Set

Based on the instruction set configuration, the microcontroller is further divided into two
categories.

● CISC − CISC stands for complex instruction set computer. It allows the user to
insert a single instruction as an alternative to many simple instructions.
● RISC − RISC stands for Reduced Instruction Set Computers. It reduces the
operational time by shortening the clock cycle per instruction.

Applications of Microcontrollers

Microcontrollers are widely used in various different devices such as −

● consumer electronics​ – Televisions and digital cameras; computer printers; video


game consoles and home entertainment systems like PS4.
● Household appliances​ – Refrigerators; washing machines, microwave ovens, air
conditioners
● Medical equipment​ – Scanners like those for MRI, CT; ECG machines; devices
to monitor blood pressure and heartbeat
● Automobiles​ – Fuel injection systems, anti-lock braking systems, music and
entertainment systems, controls for air-conditioner
● Industrial applications​ – Assembly lines, systems for feedback, systems for data
collection
● Aerospace​ – Systems for navigation and guidance, GPS
● Communications​ – Routers, satellite phones

Advantages of Embedded System

The advantages of Embedded Systems are:


● T hey are convenient for mass production. This results in low price per piece.
● These systems are highly stable and reliable.
● Embedded systems are made for specific tasks.
● The embedded systems are very small in size, hence can be carried and loaded
anywhere.
● These systems are fast. They also use less power.
● The embedded systems optimize the use or resources available.
● They improve the product quality.

Disadvantages of Embedded System

The disadvantages of Embedded Systems are as follows:

● Once configured, these systems cannot be changed. Hence, no improvement or


upgradation on the ones designed and created can be made.
● They are hard to maintain. It is also difficult to take a back-up of embedded files.
● Troubleshooting is difficult for embedded systems. Transferring data from one
system to another is also quite problematic.
● Because these systems are made for specific tasks, hardware is limited.

Von Neumann vs Harvard Architecture

Von Neumann Architecture: 

Von  Neumann  Architecture  is  a  digital  computer architecture whose design is based on 

the  concept  of  stored  program  computers  where program data and instruction data are 

stored  in  the  same  memory.  This  architecture  was  designed  by  the  famous 
mathematician and physicist ​John Von Neumann​ in 1945. 
 

Harvard Architecture: 

Harvard  Architecture  is  the  digital  computer  architecture  whose  design  is  based  on the 

concept  where  there  are  separate  storage  and  separate  buses  (signal  path)  for 

instruction  and  data.  It  was  basically  developed  to  overcome  the  bottleneck  of  Von 
Neumann Architecture. 
 

Difference between Von Neumann and Harvard Architecture : 

VON NEUMANN ARCHITECTURE  HARVARD ARCHITECTURE 


It is ancient computer architecture  It is modern computer architecture 

based on stored program computer  based on the Harvard Mark I relay 

concepts.  based model. 

Same physical memory address is  Separate physical memory address is 

used for instructions and data.  used for instructions and data. 

There is a common bus for data and  Separate buses are used for 

instruction transfer.  transferring data and instruction. 

Two clock cycles are required to  An instruction is executed in a single 

execute a single instruction.  cycle. 

It is more costly than Von Neumann 


It is cheaper in cost. 
architecture. 

The CPU can not access instructions  CPU can access instructions and 

and read/write at the same time.  read/write at the same time. 

It is used in personal computers and  It is used in microcontrollers and 

small computers.  signal processing. 

8051 Microcontroller Architecture

Let's see the internal architecture of 8051 Microcontroller represented in form of block
diagram as shown below:
Basic components present internally inside 8051 Microcontroller architecture are:

CPU (Central Processing Unit)​: CPU acts as a mind of any processing machine. It

synchronizes and manages all processes that are carried out in microcontrollers. User has
no power to control the functioning of the CPU. It interprets the program stored in ROM and

carries out from storage and then performs it projected duty. CPUs manage the different
types of registers available in 8051 microcontrollers.

Interrupts​: Interrupts is a subroutine call that is given by the microcontroller when some
other program with high priority is requested for acquiring the system buses then interrupts

occur in the current running program.

Interrupts provide a method to postpone or delay the current process, perform a

sub-routine task and then restart the standard program again.

Types of interrupt in 8051 Microcontroller:

Let's see the five sources of interrupts in 8051 Microcontroller:

● Timer 0 overflow interrupt - TF0

● Timer 1 overflow interrupt - TF1


● External hardware interrupt - INT0

● External hardware interrupt - INT1

● Serial communication interrupt - RI/TI

Memory​: For operation Microcontroller required a program. This program guides the

microcontroller to perform the specific tasks. This program installed in microcontroller


required some on chip memory for the storage of the program.

Microcontrollers also required memory for storage of data and operands for the short
duration. In microcontroller 8051 there is code or program memory of 4 KB that is 4 KB

ROM and it also comprises data memory (RAM) of 128 bytes.

Bus ​: Bus is a group of wires which is used as a communication canal or acts as means of

data transfer. The different bus configuration includes 8, 16 or more cables. Therefore, a
bus can bear 8 bits, 16 bits all together.

Types of buses in 8051 Microcontroller:

Let's see the two types of bus used in 8051 microcontroller:

● Address Bus​: 8051 microcontrollers consist of 16 bit address bus. It is generally


used for transferring the data from the Central Processing Unit to Memory.

● Data bus​: 8051 microcontroller consists of 8 bits data bus. It is generally used for
transferring the data from one peripherals position to other peripherals.

Oscillator​: As the microcontroller is a digital circuit therefore it needs timer for their
operation. To perform timer operation inside a microcontroller it required an externally

connected or on-chip oscillator. Microcontroller is used inside an embedded system for


managing the function of devices. Therefore, 8051 uses the two 16 bit counters and timers.

For the operation of this timer and counters the oscillator is used inside the microcontroller.

8051 Microcontroller Memory Allocation


The 8051 Microcontroller Memory is separated in Program Memory (ROM)
and Data Memory (RAM). The Program Memory of the 8051 Microcontroller is
used for storing the program to be executed i.e. instructions. The Data
Memory on the other hand, is used for storing temporary variable data and
intermediate results.

8051 Microcontroller has both Internal ROM and Internal RAM. If the internal
memory is inadequate, you can add external memory using suitable circuits.

Program Memory (ROM) of 8051 Microcontroller

In 8051 Microcontroller, the code or instructions to be executed are stored in


the Program Memory, which is also called as the ROM of the Microcontroller.
The original 8051 Microcontroller by Intel has 4KB of internal ROM.

Some variants of 8051 like the 8031 and 8032 series don't have any internal
ROM (Program Memory) and must be interfaced with external Program
Memory with instructions loaded in it.

Almost all modern 8051 Microcontrollers, like 8052 Series, have 8KB of
Internal Program Memory (ROM) in the form of Flash Memory (ROM) and
provide the option of reprogramming the memory.
In case of 4KB of Internal ROM, the address space is 0000H to 0FFFH. If the
address space i.e. the program addresses exceed this value, then the CPU
will automatically fetch the code from the external Program Memory.

For this, the External Access Pin (EA Pin) must be pulled HIGH i.e. when the
EA Pin is high, the CPU first fetches instructions from the Internal Program
Memory in the address range of 0000H to 0FFFFH and if the memory
addresses exceed the limit, then the instructions are fetched from the external
ROM in the address range of 1000H to FFFFH.
There is another way to fetch the instructions: ignore the Internal ROM and
fetch all the instructions only from the External Program Memory (External
ROM). For this scenario, the EA Pin must be connected to GND. In this case,
the memory addresses of the external ROM will be from 0000H to FFFFH.
Data Memory (RAM) of 8051 Microcontroller

The Data Memory or RAM of the 8051 Microcontroller stores temporary data
and intermediate results that are generated and used during the normal
operation of the microcontroller. Original Intel’s 8051 Microcontroller had 128B
of internal RAM.

But almost all modern variants of 8051 Microcontroller have 256B of RAM. In
this 256B, the first 128B i.e. memory addresses from 00H to 7FH is divided in
to Working Registers (organized as Register Banks), Bit – Addressable Area
and General Purpose RAM (also known as Scratchpad area).

In the first 128B of RAM (from 00H to 7FH), the first 32B i.e. memory from
addresses 00H to 1FH consists of 32 Working Registers that are organized as
four banks with 8 Registers in each Bank.
The 4 banks are named as Bank0, Bank1, Bank2 and Bank3. Each Bank
consists of 8 registers named as R0 – R7. Each Register can be addressed in
two ways: either by name or by address.

To address the register by name, first the corresponding Bank must be


selected. In order to select the bank, we have to use the RS0 and RS1 bits of
the Program Status Word (PSW) Register (RS0 and RS1 are 3​rd and 4​th bits
in the PSW Register).

When addressing the Register using its address i.e. 12H for example, the
corresponding Bank may or may not be selected. (12H corresponds to R2 in
Bank2).

The next 16B of the RAM i.e. from 20H to 2FH are Bit – Addressable memory
locations. There are totally 128 bits that can be addressed individually using
00H to 7FH or the entire byte can be addressed as 20H to 2FH.

For example 32H is the bit 2 of the internal RAM location 26H.

The final 80B of the internal RAM i.e. addresses from 30H to 7FH, is the
general purpose RAM area which are byte addressable.

These lower 128B of RAM can be addressed directly or indirectly.

The upper 128B of the RAM i.e. memory addresses from 80H to FFH is
allocated for Special Function Registers (SFRs). SFRs control specific
functions of the 8051 Microcontroller. Some of the SFRs are I/O Port
Registers (P0, P1, P2 and P3), PSW (Program Status Word), A
(Accumulator), IE (Interrupt Enable), PCON (Power Control), etc.
SRFs Memory addresses are only direct addressable. Even though some of
the addresses between 80H and FFH are not assigned to any SFR, they
cannot be used as additional RAM area.

In some microcontrollers, there is an additional 128B of RAM, which share the


memory address with SFRs i.e. 80H to FFH. But, this additional RAM block is
only accessed by indirect addressing.

Interfacing External Memory with 8051 Microcontroller


We have seen that a typical 8051 Microcontroller has 4KB of ROM and 128B
of RAM (most modern 8051 Microcontroller variants have 8K ROM and 256B
of RAM).

The designer of an 8051 Microcontroller based system is not limited to the


internal RAM and ROM present in the 8051 Microcontroller. There is a
provision of connecting both external RAM and ROM i.e. Data Memory and
Program.

The reason for interfacing external Program Memory or ROM is that complex
programs written in high – level languages often tend to be larger and occupy
more memory.

Another important reason is that chips like 8031 or 8032, which doesn’t have
any internal ROM, have to be interfaced with external ROM.

A maximum of 64B of Program Memory (ROM) and Data Memory (RAM)


each can be interface with the 8051 Microcontroller.

The following image shows the block diagram of interfacing 64KB of External
RAM and 64KB of External ROM with the 8051 Microcontroller.
In this tutorial, we have seen the 8051 Microcontroller Memory Organization,
Internal ROM and RAM and how to interface external ROM and RAM with
8051 Microcontroller.

Interrupts of 8051

Interrupts are the events that temporarily suspend the main program, pass the control
to the external sources and execute their task. It then passes the control to the main
program where it had left off.

8051 has 5 interrupt signals, i.e. INT0, TFO, INT1, TF1, RI/TI. Each interrupt can be
enabled or disabled by setting bits of the IE register and the whole interrupt system can
be disabled by clearing the EA bit of the same register.

IE (Interrupt Enable) Register


This register is responsible for enabling and disabling the interrupt. EA register is set to
one for enabling interrupts and set to 0 for disabling the interrupts. Its bit sequence and
their meanings are shown in the following figure.

It disables all interrupts. When EA = 0 no interrupt will be


EA IE.7
acknowledged and EA = 1 enables the interrupt individually.

- IE.6 Reserved for future use.

- IE.5 Reserved for future use.


ES IE.4 Enables/disables serial port interrupt.

ET1 IE.3 Enables/disables timer1 overflow interrupt.

EX1 IE.2 Enables/disables external interrupt1.

ET0 IE.1 Enables/disables timer0 overflow interrupt.

EX0 IE.0 Enables/disables external interrupt0.

IP (Interrupt Priority) Register


We can change the priority levels of the interrupts by changing the corresponding bit in
the Interrupt Priority (IP) register as shown in the following figure.

● A low priority interrupt can only be interrupted by the high priority interrupt, but
not interrupted by another low priority interrupt.
● If two interrupts of different priority levels are received simultaneously, the
request of higher priority level is served.
● If the requests of the same priority levels are received simultaneously, then the
internal polling sequence determines which request is to be serviced.

- IP.6 Reserved for future use.

- IP.5 Reserved for future use.

PS IP.4 It defines the serial port interrupt priority level.

PT1 IP.3 It defines the timer interrupt of 1 priority.


PX1 IP.2 It defines the external interrupt priority level.

PT0 IP.1 It defines the timer0 interrupt priority level.

PX0 IP.0 It defines the external interrupt of 0 priority level.

TCON Register
TCON register specifies the type of external interrupt to the microcontroller.

Addressing modes of 8051

In this section, we will see different addressing modes of the 8051 microcontrollers. In
8051 there are 1-byte, 2-byte instructions and very few 3-byte instructions are present.
The opcodes are 8-bit long. As the opcodes are 8-bit data, there are 256 possibilities.
Among 256, 255 opcodes are implemented.

The clock frequency is12MHz, so 64 instruction types are executed in just 1 µs, and rest
are just 2 µs. The Multiplication and Division operations take 4 µsto to execute.

In 8051 There are six types of addressing modes.

● Immediate AddressingMode
● Register AddressingMode
● Direct AddressingMode
● Register IndirectAddressing Mode
● Indexed AddressingMode
● Implied AddressingMode

Immediate addressing mode


In this Immediate Addressing Mode, the data is provided in the instruction itself. The
data is provided immediately after the opcode. These are some examples of Immediate
Addressing Mode.

MOVA​,​ ​#0AFH;

MOVR3​,​ ​#45H;

MOVDPTR​,​ ​#FE00H;

In these instructions, the # symbol is used for immediate data. In the last instruction,
there is DPTR. The DPTR stands for Data Pointer. Using this, it points the external data
memory location. In the first instruction, the immediate data is AFH, but one 0 is added
at the beginning. So when the data is starting with A to F, the data should be preceded
by 0.

Register addressing mode

In the register addressing mode the source or destination data should be present in a
register (R0 to R7). These are some examples of RegisterAddressing Mode.

MOVA​,​ R5​;

MOVR2​,​ ​#45H;

MOVR0​,​ A​;

In 8051, there is no instruction like ​MOVR5, R7​. But we can get the same result by
using this instruction ​MOV R5, 07H​, or by using ​MOV 05H, R7​. But this two instruction
will work when the selected register bank is ​RB0​. To use another register bank and to
get the same effect, we have to add the starting address of that register bank with the
register number. For an example, if the RB2 is selected, and we want to access R5,
then the address will be (10H + 05H = 15H), so the instruction will look like this ​MOV
15H, R7​. Here 10H is the starting address of Register Bank 2.

Direct Addressing Mode

In the Direct Addressing Mode, the source or destination address is specified by using
8-bit data in the instruction. Only the internal data memory can be used in this mode.
Here some of the examples of direct Addressing Mode.
MOV80H​,​ R6​;

MOVR2​,​ ​45H​;

MOVR0​,​ ​05H​;

The first instruction will send the content of registerR6 to port P0 (Address of Port 0 is
80H). The second one is forgetting content from 45H to R2. The third one is used to get
data from Register R5 (When register bank RB0 is selected) to register R5.

Register indirect addressing Mode

In this mode, the source or destination address is given in the register. By using register
indirect addressing mode, the internal or external addresses can be accessed. The R0
and R1 are used for 8-bit addresses, and DPTR is used for 16-bit addresses, no other
registers can be used for addressing purposes. Let us see some examples of this
mode.

MOV0E5H​,​ ​@R0​;

MOV@R1​,​ ​80H

In the instructions, the @ symbol is used for register indirect addressing. In the first
instruction, it is showing that theR0 register is used. If the content of R0 is 40H, then
that instruction will take the data which is located at location 40H of the internal RAM. In
the second one, if the content of R1 is 30H, then it indicates that the content of port P0
will be stored at location 30H in the internal RAM.

MOVXA​,​ ​@R1​;

MOV@DPTR​,​ A​;

In these two instructions, the X in MOVX indicates the external data memory. The
external data memory can only be accessed in register indirect mode. In the first
instruction if the R0 is holding 40H, then A will get the content of external RAM
location40H. And in the second one, the content of A is overwritten in the location
pointed by DPTR.

Indexed addressing mode


In the indexed addressing mode, the source memory can only be accessed from
program memory only. The destination operand is always the register A. These are
some examples of Indexed addressing mode.

MOVCA​,​ ​@A​+​PC​;

MOVCA​,​ ​@A​+​DPTR​;

The C in MOVC instruction refers to code byte. For the first instruction, let us consider A
holds 30H. And the PC value is1125H. The contents of program memory location
1155H (30H + 1125H) are moved to register A.

Implied Addressing Mode

In the implied addressing mode, there will be a single operand. These types of
instruction can work on specific registers only. These types of instructions are also
known as register specific instruction. Here are some examples of Implied Addressing
Mode.

RLA​;

SWAPA​;

These are 1- byte instruction. The first one is used to rotate the A register content to the
Left. The second one is used to swap the nibbles in A.

PIC Intro & Features 


PIC Architecture 
The ​PIC microcontroller is based on RISC architecture. Its memory

architecture follows the Harvard pattern of separate memories for program

and data, with separate buses.


1. Memory Structure
The PIC architecture consists of two memories: Program memory and Data

memory.

Program Memory: This is a 4K*14 memory space. It is used to store 13-bit

instructions or the program code. The program memory data is accessed by

the program counter register that holds the address of the program memory.

The address 0000H is used as reset memory space and 0004H is used as

interrupt memory space.

Data Memory: The data memory consists of the 368 bytes of RAM and 256

bytes of EEPROM. The 368 bytes of RAM consists of multiple banks. Each

bank consists of general-purpose registers and special function registers.

The special function registers consist of control registers to control different

operations of the chip resources like Timers, ​Analog to Digital Converters​,


Serial ports, I/O ports, etc. For example, the TRISA register whose bits can be

changed to alter the input or output operations of the port A.

The general-purpose registers consist of registers that are used to store

temporary data and processing results of the data. These general-purpose

registers are each 8-bit registers.

Working Register: It consists of a memory space that stores the operands for

each instruction. It also stores the results of each execution.

Status Register: The bits of the status register denotes the status of the ALU

(arithmetic logic unit) after every execution of the instruction. It is also used to

select any one of the 4 banks of the RAM.

File Selection Register: It acts as a pointer to any other general-purpose

register. It consists of a register file address, and it is used in indirect

addressing.

Another general-purpose register is the program counter register, which is a

13-bit register. The 5 upper bits are used as PCLATH (Program Counter

Latch) to independently function as any other register, and the lower 8-bits are

used as the program counter bits. The program counter acts as a pointer to

the instructions stored in the program memory.

EEPROM: It consists of 256 bytes of memory space. It is a permanent

memory like ROM, but its contents can be erased and changed during the

operation of the microcontroller. The contents into EEPROM can be read from

or written to, using special function registers like EECON1, EECON, etc.
2. I/O Ports
PIC16 series consists of five ports, such as Port A, Port B, Port C, Port D, and

Port E.

Port A: It is a 16-bit port, which can be used as an input or output port based

on the status of the TRISA register.

Port B: It is an 8-bit port, which can be used as both an input and output port.

4 of its bits, when used as input, can be changed upon interrupt signals.

Port C: It is an 8-bit port whose operation (input or output) is determined by

the status of the TRISC register.

Port D: It is an 8-bit port, which apart from being an I/O port, acts as a slave

port for connection to the ​microprocessor​ bus.

Port E: It is a 3-bit port that serves the additional function of the control

signals to the A/D converter.

3. Timers
PIC microcontrollers consist of 3 ​timers​, out of which the Timer 0 and Timer 2

are 8-bit timers and the Time-1 is a 16-bit timer, which can also be used as a

counter​.

4. A/D Converter
The PIC Microcontroller consists of 8-channels, 10-bit Analog to Digital

Converter. The operation of the ​A/D converter ​is controlled by these special

function registers: ADCON0 and ADCON1. The lower bits of the converter are
stored in ADRESL (8 bits), and the upper bits are stored in the ADRESH

register. It requires an analog reference voltage of 5V for its operation.

5. Oscillators
Oscillators ​are used for timing generation. PIC microcontrollers consist of

external oscillators like crystals or RC oscillators. In the case of crystal

oscillators, the crystal is connected between two oscillator pins, and the value

of the capacitor connected to each pin determines the mode of operation of

the oscillator. The different modes are low-power mode, crystal mode, and the

high- speed mode. In the case of RC oscillators, the value of the Resistor and

Capacitor determines the clock frequency. The clock frequency ranges from

30 kHz to 4 MHz.

6. CCP module:
A CCP module works in the following three modes:

Capture Mode: This mode captures the time of arrival of a signal, or in other

words, captures the value of the Timer1 when the CCP pin goes high.

Compare Mode: It acts as an analog comparator that generates an output

when the timer1 value reaches a certain reference value.

PWM Mode: It provides ​pulse width modulated output with a 10-bit resolution

and programmable duty cycle.

Other special peripherals include a Watchdog timer that resets the

microcontroller in case of any software malfunction and a Brownout reset that


resets the microcontroller in case of any power fluctuation and others. For a

better understanding of this PIC microcontroller, we are giving one practical

project which uses this controller for its operation.

Register Memory Organization in PIC 16F877

A register is a place inside the PIC which used to read or write the data/program.
The memory of the PIC is divided into a series of registers. Each of the registers
has its own address and memory locations. These addresses are normally denoted
by using hexadecimal numbers. According to the type of working and usage, the
registers in PIC are classified into two categories.

General Purpose Registers (GPR)

GPR is a small amount of storage that can be accessible more quickly than any
other memory. These register files can be accessed either directly, or indirectly,
through the File Select Register (FSR). The General Purpose Register (GPR)
memory map (PIC16F877A) is shown in the figure below.

Special Function Registers (SFR)

The special function registers are also memory registers which is used for special
dedicated functions. These registers perform various dedicated functions inside the
PIC chip. Each special function inside this PIC chip is controlled by using these
registers. These registers are used by the CPU and peripheral modules for
controlling the desired operation of the device. These registers are normally
implemented as in the form of static RAM memory. A list of these registers is
given in the tables below. The Special Function Registers can be classified into
two sets: core (CPU) and peripheral. Those registers associated with the core
functions are described in detail in this section. The figures below shows SFR
memory map of PIC16F877.

Status Register

Status register is an eight bit register that contains the arithmetic status of the
arithmetic logic unit (ALU), the reset status and the bank select bits for the data
memory. The detailed explanation of status register is given below.

Status registers (address 03h, 83h, 103h, and 183h)

R/W*- R/W- R/W- R/W- R/W- R/W-


R-1 R-1
0 0 0 x** x x

IRP RP1 RP0 TO PD Z DC C

Bit7
Bit 0

(*R/W-readable/writable, **x-unknown bit)

● Bit 7 – (IRP): this is a Register Bank Select Bit usually used for
indirect addressing mode.
● Bit 6-5 (RP1:RP0): these bits are Register Bank Select bits commonly
used for direct addressing mode (each banks in this mode carry 128
byes)

(11 = Bank 3 (180h-1FFh)

10 = Bank 2 (100h-17Fh)

01 = Bank 1 (80h-FFh)

00 = Bank 0 (00h-7Fh))

● Bit 4, (TO): this is a time-out bit used for timing and counting, sleep
and reset functions.

(1 = after power-up, CLRWDT instruction or SLEEP instruction

0 = A WDT time-out occurred)

● Bit 3, (PD): Power-down bit

(1 = after power-up or by the CLRWDT instruction

0 = by execution of the SLEEP instruction)


● Bit 2, (Z): Zero bit

(1 = the result of an arithmetic or logic operation is zero

0 = the result of an arithmetic or logic operation is not zero.)

● Bit 1 DC: Digit carry/borrow bit (ADDWF, ADDLW, SUBLW, SUBWF


instructions)

(For borrow, the polarity is reversed)

(1 = A carry-out from the 4th low order bit of the result occurred

0 = No carry-out from the 4th low order bit of the result.)

● Bit 0 (C): Carry/borrow bit (ADDWF, ADDLW, SUBLW, SUBWF


instructions)

(1 = A carry-out from the Most Significant bit of the result occurred

0 = No carry-out from the Most Significant bit of the result occurred.)

Option Register
The option Register is a readable and writable register, which contains various
control bits to configure the TMR0 prescaler/WDT postscaler (single assignable
register known also as the pre-scaler), the external INT interrupt andTMR0 and
the weak pull-ups on PORTB. Structure of option register is shown below.

R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 R/W-1

RBPU(inverting) INTEDG T0CS T0SE PSA PS2 PS1 PS0

7
0

● Bit 7 (RBPU): This is a PORTB Pull-up Enable bit. If this bit is ‘1’ then
PORTB pull-up function disabled. If this bit is ‘0’, it enabled the pull-up
function by individual port-latch values.

(1 = PORTB pull-ups are disabled.

0 = PORTB pull-ups are enabled by individual port latch values.)

● Bit 6 (INTEDG): This is an Interrupt Edge Select bit. This bit decided if
the interrupt is on either raisin edge or falling edge. The function of
this bit is given below.
(1 = Interrupt on rising edge of RB0/INT pin.

0 = Interrupt on falling edge of RB0/INT pin.)

● Bit 5 (T0CS): this is a timer-0(TMR0) Clock Source Select bit and its
function is given below.

(1 = Transition on RA4/T0CKI pin.

0 = Internal instruction cycle clock (CLKO).)

● Bit 4 (T0SE): TMR0 Source Edge Select bit which select the timer 0
source edge.

(1 = Increment on high-to-low transition on RA4/T0CKI pin.

0 = Increment on low-to-high transition on RA4/T0CKI pin.)

● Bit 3 (PSA): Prescaler Assignment bit.

(1 = Prescaler is assigned to the Watch Dog Timer (WDT).

0 = Prescaler is assigned to the Timer0 module.)


● Bit 2-0 (PS2:PS0): Prescaler Rate Select bits.

INTCON Register

The INTCON register is a readable and writable register, which contains various
enable and flag bits for the TMR0 register overflow, RB port change and external
RB0/INT pin interrupts. The architecture of this register is given below.

R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-x

GIE PEIE TMR0IE INTE RBIE TMR0IF INTF RBIF

● Bit 7 GIE: Global Interrupt Enable bit. If this bit is enable (‘1’), which
also enable all unmasked interrupts and if it is zero (‘0’), which disable
all interrupts.

(1 = Enables all unmasked interrupts.

0 = Disables all interrupts.)


● Bit 6 (PEIE): this is a Peripheral Interrupt Enable bit which used for
controlling peripheral interrupts. If this bit is enable(‘1’), also enable all
unmasked peripheral interrupts and if it is disable(‘0’), also disable all
active peripheral interrupt actions.

(1 = Enables all unmasked peripheral interrupts

0 = Disables all peripheral interrupts)

● Bit 5 (TMR0IE): This is timer 0(TMR0) Overflow Interrupt Enable bit


which control the overflow interrupt in timer 0.

(1 = Enables the TMR0 interrupt

0 = Disables the TMR0 interrupt)

● Bit 4 (INTE): This is an RB0/INT External Interrupt Enable bit which


used for enable/disable external interrupts.

(1 = Enables the RB0/INT external interrupt

0 = Disables the RB0/INT external interrupt)


● Bit 3 (RBIE): RB Port Change Interrupt Enable bit which control
PORTB change interrupt.

(1 = Enables the RB port change interrupt.

0 = Disables the RB port change interrupt.)

● Bit 2 (TMR0IF): TMR0 Overflow Interrupt Flag bit which controls the
overflow of timer 0.

(1 = TMR0 register has overflowed [must be cleared in software]

0 = TMR0 register did not overflow)

● Bit 1 (INTF): RB0/INT External Interrupt Flag control bit.

(1 = The RB0/INT external interrupt occurred (must be cleared in software)

0 = The RB0/INT external interrupt did not occur).

● Bit 0 (RBIF): RB Port Change Interrupt Flag bit.


(1 = At least one of the RB7:RB4 pins changed state; a mismatch condition will
continue to set that bit. Reading PORTB will end the mismatch condition and
allow the bit to be cleared

[Must be cleared in software] ).

PIE1 Register

The PIE1 register contains the individual enable bits for the peripheral interrupts.
The structure of this register is shown below.

R/W- R/W R/W- R/W- R/W-


R/W-0 R/W-0 R/W-0
0 -0 0 0 0

PSPI ADI RCI SSPI CCP1 TMR2I TMR1I


TXIE
E E E E IE E E

● Bit 7 (PSPIE): this bit is the Parallel Slave Port Read/Write Interrupt
Enable bit

(1 = Enables the PSP read/write interrupt

0 = Disables the PSP read/write interrupt)


● Bit 6 (ADIE): A/D Converter Interrupt Enable bit which control the
analog to digital converter interrupt.

(1 = Enables the A/D converter interrupt

0 = Disables the A/D converter interrupt)

● Bit 5 (RCIE): USART Receive Interrupt Enable bit which control the
USART data reception interrupt.

(1 = Enables the USART receive interrupt

0 = Disables the USART receive interrupt)

● Bit 4 (TXIE): USART Transmit Interrupt Enable bit that control USART
data transmission.

(1 = Enables the USART transmit interrupt

0 = Disables the USART transmit interrupt)

● Bit 3 (SSPIE): Synchronous Serial Port Interrupt Enable bit that control
SSP data interrupt.
(1 = Enables the SSP interrupt

0 = Disables the SSP interrupt)

● Bit 2 (CCP1IE): CCP1 Interrupt Enable bit which control the


capture-compare-pulse width modulation interrupt.

(1 = Enables the CCP1 interrupt

0 = Disables the CCP1 interrupt)

● Bit 1 (TMR2IE): TMR2 to PR2 Match Interrupt Enable bit.

(1 = Enables the TMR2 to PR2 match interrupt

0 = Disables the TMR2 to PR2 match interrupt)

● Bit 0 (TMR1IE): TMR1 Overflow Interrupt Enable bit that control the
overflow interrupt of timer 1 module.

(1 = Enables the TMR1 overflow interrupt

0 = Disables the TMR1 overflow interrupt)


PIR1 Register

The PIR1 register contains the individual flag bits for the peripheral interrupt. The
structure of PIR1 register is given below.

R/W- R/W- R/W-


R-0 R-0 R/W-0 R/W-0 R/W-0
0 0 0

PSPI RCI TXI SSPI CCP1 TMR2I TMR1I


ADIF
F F F F IF F F

● Bit 7 (PSPIF): Parallel Slave Port Read/Write Interrupt Flag bit.

(1 = A read or a write operation has taken place (must be cleared in software)

0 = No read or write has occurred)

● Bit 6 (ADIF): A/D Converter Interrupt Flag bit that control the interrupt
flag for that analog to digital converter.
(1 = An A/D conversion completed

0 = The A/D conversion is not complete)

● Bit 5 (RCIF): USART Receive Interrupt Flag bit.

(1 = The USART receive buffer is full

0 = The USART receive buffer is empty)

● Bit 4 (TXIF): USART Transmit Interrupt Flag bit.

(1 = The USART transmit buffer is empty

0 = The USART transmit buffer is full)

● Bit 3 (SSPIF): Synchronous Serial Port (SSP) Interrupt Flag bit that
control the SSP interrupt flag in a PIC.

(1 = The SSP interrupt condition has occurred and must be cleared in software
before returning from the Interrupt Service Routine. The conditions that will set
this bit are:

• SPI – A transmission/reception has taken place.


• I2C Slave – A transmission/reception has taken place.

• I2C Master

– A transmission/reception has taken place.

– The initiated Start condition was completed by the SSP module.

– The initiated Stop condition was completed by the SSP module.

– The initiated Restart condition was completed by the SSP module.

– The initiated Acknowledge condition was completed by the SSP module.

– A Start condition occurred while the SSP module was Idle (multi-master
system).

– A Stop condition occurred while the SSP module was Idle (multi-master
system).

0 = No SSP interrupt condition has occurred)

● Bit 2 (CCP1IF): CCP1 Interrupt Flag bit that control


capture-compare-pulse width modulation interrupt flag. It works in
three modes. They are given below.

1. Capture mode:

1 = A TMR1 register capture occurred (must be cleared in software)


0 = No TMR1 register capture occurred

2. Compare mode:

1 = A TMR1 register compare match occurred (must be cleared in software)

0 = No TMR1 register compare match occurred

3. PWM mode:

● Bit 1 (TMR2IF): TMR2 to PR2 Match Interrupt Flag bit

(1 = TMR2 to PR2 match occurred (must be cleared in software)

0 = No TMR2 to PR2 match occurred)

● Bit 0 (TMR1IF): TMR1 Overflow Interrupt Flag bit.

(1 = TMR1 register overflowed (must be cleared in software)

0 = TMR1 register did not overflow)

PIE2 Register

The PIE2 register contains the individual enable bits for the CCP2 peripheral
interrupt, the SSP bus collision
Interrupt, EEPROM write operation interrupt and the comparator interrupt. The
structure of this register is given below.

R/ R/ R/
R/W
U-0 W- U-0 W- W- U-0 U-0
-0
0 0 0

C CC
——— ——— EE BC ——— ———
MI P2I
—— —— IE LIE ——- ——
E E

● Bit 7 Unimplemented: Read as ‘0’


● Bit 6 (CMIE): Comparator Interrupt Enable bit

(1 = Enables the comparator interrupt

0 = Disable the comparator interrupt)

● Bit 5 Unimplemented: Read as ‘0’


Bit 4 (EEIE): EEPROM Write Operation Interrupt Enable bit

(1 = Enable EEPROM write interrupt

0 = Disable EEPROM write interrupt)

● Bit 3 (BCLIE): Bus Collision Interrupt Enable bit.

(1 = Enable bus collision interrupt

0 = Disable bus collision interrupt)

● Bit 2-1 Unimplemented: Read as ‘0’


● Bit 0 (CCP2IE): CCP2 Interrupt Enable bit.

(1 = Enables the CCP2 interrupt

0 = Disables the CCP2 interrupt)

PIR2 Register

The PIR2 register contains the flag bits for the CCP2 interrupt, the SSP bus
collision interrupt, EEPROM write operation interrupt and the comparator
interrupt. The structure of this register is given below.
R/ R/ R/
R/W
U-0 W- U-0 W- W- U-0 U-0
-0
0 0 0

C CC
——— ——— EE BC ——— ———
MI P2I
—— —— IF LIF —- ——
F F

● Bit 7 Unimplemented: Read as ‘0’


● Bit 6 (CMIF): Comparator Interrupt Flag bit

(1 = the comparator input has changed (must be cleared in software)

0 = the comparator input has not changed)

● Bit 5 Unimplemented: Read as ‘0’


● Bit 4 (EEIF): EEPROM Write Operation Interrupt Flag bit.

(1 = the write operation completed (must be cleared in software)


0 = the write operation is not complete or has not been started)

● Bit 3 (BCLIF): Bus Collision Interrupt Flag bit.

(1 = A bus collision has occurred in the SSP when configured for I2C Master
Mode

0 = No bus collision has occurred)

● Bit 2-1 Unimplemented: Read as ‘0’


● Bit 0 (CCP2IF): CCP2 Interrupt Flag bit. This also works in three
modes. They ere

1. Capture mode:

1 = A TMR1 register capture occurred (must be cleared in software)

0 = No TMR1 register capture occurred

Compare mode:

1 = A TMR1 register compare match occurred (must be cleared in software)

0 = No TMR1 register compare match occurred

2. PWM mode:
This mode is not used.

PCON Register

The Power Control (PCON) register contains flag bits to allow differentiation
between a Power-on Reset

(POR), a Brown-out Reset (BOR), a Watchdog Reset (WDT) and an external


MCLR Reset. The structure of this register is given below.

U-
U-0 U-0 U-0 U-0 U-0 R/W-0 R/W-1
0

— — — — — —— POR(inver BOR(inver
— —- —- —- —- — ting) ting)

● Bit 7-2 Unimplemented: Read as ‘0’


● Bit 1 (POR): Power-on Reset Status bit

(1 = No Power-on Reset occurred

0 = A Power-on Reset occurred (must be set in software after a Power-on Reset


occurs)
● Bit 0(BOR): Brown-out Reset Status bit

(1 = No Brown-out Reset occurred

0 = A Brown-out Reset occurred (must be set in software after a Brown-out Reset


occurs).

Interfacing EEPROM 
with PIC 
Microcontroller – I2C 
Based 
In  the  article,  we  see  the  interfacing  EEPROM with PIC Microcontrollers using the 
I2C  Protocol​.  In  the  real world, microcontrollers have a limited amount of memory. 
Sometimes  the  limited  amount  of  memory  becomes  a  big  issue  and  creates  a 

roadblock to the development of a project. 

Each  microcontroller  provides  flexibility  to  connect  an  external  memory  to  store 
the  required  data.  These  data  can  store  in  memory  by  using  the  I2C,  SPI  or  other 

communication protocol. 

Here,  I  am  explaining  an  example,  where  I  will  store  a  single  byte  in  an  EEPROM 
and  after  that,  I  will  read back the written byte from the EEPROM. For verification, 
I  will  compare  read  bytes  from  the  bytes  which  have  been  written  and  toggle  ​LED 

if both the bytes are equal. 

  

What is an EEPROM? 
An  EEPROM  is  a  non-volatile  memory  that  means  it  can  store  the  data 
permanently  without  any  power  supply.  EEPROM  stands  for  Electrically  Erasable 
Programmable  Read-Only  Memory.  We  can  erase  the  EEPROM  data  by  the  UV 
eraser. 

An  EEPROM  is  slower  than  the  flash  memory.  In  flash  memory,  we  can  erase  the 

whole  sector  at  a  time but in the case of EEPROM, we can erase a single byte at the 


time. 

Some  microcontrollers  confine a small amount of EEPROM to store the extra bytes 

which are required in the program, for example, usernames and passwords. 

  
There  are  many  vendors  who  make  different  kinds  of  EEPROM  but in this article, I 
will  only  discuss  24lc64  (manufactured  by the microchip). The 24lc64 (EEPROM) is 

connected to the Microcontroller through the​ I2C bus protocol​. 

  

There some important features of 24lc64 (EEPROM) 


● Organized as 8 blocks of 8kbit (64 Kbit). 
● The interface through two-wire (I2C). 
● Page write buffer up to 32 bytes 
● We can read/ write on it approximately one million times. 

● It can retain the data for more than 200 years. 

  

Control bytes of 24lc64 (EEPROM) 


Before  starting  the  programming,  we  have  to  aware  of  the  addressing  of  24lc64 
(EEPROM).  It  contains  a  control  byte  which  sends  by  the  master  in  I2C 

communication  followed  by  a start condition. The control byte confines the control 


code, chip -select and read/write bits. 

The  control  code  for  the  24lc64  is  “1010”  for  the  read  and  write  operation.  The 
chip  select  size  is  3  bits (A2, A1, A0) it allows the user to connect the maximum of 8 
devices  to  the  ​I2c  bus​.  The  last  bit  of  the  control  byte  is  read/write  bits,  this  bit  is 

zero for the write operation and one for the read operation. 
 

  

Basic Requirements for interfacing EEPROM with PIC 

Knowledge of I2C protocol 

When  you  want  to  interface  an  EEPROM  with  a  microcontroller  then  you  need  to 
have  a  good  knowledge  of  I2C  protocol.  If  you  are  not  aware  of  the  I2C  protocol 
then  don’t  need  to  worry,  it  is  a  very  simple  serial  communication  protocol.  So  it’s 
my  advice  to  you,  before  reading  the  remaining  part  of  this  article,  read  the  ​I2C 

protocol​. 

Micro-controller 

In  our  case,  the  Micro-controller  works  here  as  master  and  starts  the 

communication to perform the read and write operation on EEPROM. 

EEPROM memory 

It’s  storing  device  is used to store permanent data like user information (username, 


password). Here I am using the 24lc64 chip to store the data. 
It  has  8  blocks  of  8kbit  (8*  1024  bytes  of  data  storage).  The  chip  has  storage 
location,  each  location  has  a  unique  address  ranging  from  the  (0 to 8191) and each 

location treat as a cell. 

For  example,  after  writing  the  data  ‘K’  on  the  location  0x0001,  if  you  read  the 
location  0x0001  you  will  get  ‘K’.  Most  important  thing  is  to  remember  that  each 
cell  of  24lc64  can  store  8  bits of the data(0 -255). So if you want to store the bigger 

data then you have to use more than one cell. 

ARM Processor 

An ​ARM processor is also one of a family of CPUs based on the RISC (reduced instruction set
computer) architecture developed by Advanced RISC Machines (ARM).

An ARM makes at 32-bit and 64-bit RISC multi-core processors. RISC processors are designed
to perform a smaller number of types of computer instructions so that they can operate at a
higher speed, performing extra millions of instructions per second (MIPS). By stripping out
unnecessary instructions and optimizing pathways, RISC processors give outstanding
performance at a part of the power demand of CISC (complex instruction set computing)
procedure.

ARM processors are widely used in customer electronic devices such as smart phones, tablets,
multimedia players and other mobile devices, such as wear ables. Because of their reduced to
instruction set, they need fewer transistors, which enable a smaller die size of the ​integrated
circuitry (IC). The ARM processors, smaller size reduced difficulty and lower power expenditure
makes them suitable for increasingly miniaturized devices.

Difference  between  PIC  Microcontroller  & 


ARM Microcontroller

PIC Microcontroller:
Bus width: 8/16/32-bit
Communication Protocols: PIC, UART, USART, LIN, CAN, Ethernet, SPI, I2S

Speed: 4 Clock/instruction cycle

Memory: SRAM, FLASH

ISA: Some feature of RISC

Memory Architecture: Harvard architecture

Power Consumption: Low

Families: PIC16, PIC17, PIC18, PIC24, PIC32

Popular Microcontrollers: PIC18fXX8, PIC16f88X, PIC32MXX

ARM Microcontroller:

Bus width: 32-bit mostly also available in 64-bit

Communication Protocols: UART, USART, LIN, I2C, SPI, CAN, USB, Ethernet, I2S, DSP, SAI
(serial audio interface), IrDA

Speed: 1 clock/ instruction cycle

Memory: Flash, SDRAM, EEPROM

ISA: RISC

Memory Architecture: Modified Harvard architecture

Power Consumption: Low

Families: ARMv4,5,6,7 and series

Popular Microcontrollers: LPC2148, ARM Cortex-M0 to ARM Cortex-M7, etc.


 

You might also like