SlideShare a Scribd company logo
3
Most read
5
Most read
20
Most read
Microprocessor and Microcontroller Based Systems
Instructor: Eng.Moayed N. EL Mobaied
The Islamic University of Gaza
Faculty of Engineering
Electrical Engineering Department
‫الرحيم‬ ‫الرحمن‬ ‫هللا‬ ‫بسم‬
Lecture 3
EELE 4315 — Fall 2010
Microcontroller
Microcontroller
Microcontroller differs from a microprocessor in many ways. First and the
most important is its functionality.
In order for a microprocessor to be used, other components such as
memory, or components for receiving and sending data must be added to it.
On the other hand, microcontroller is designed to be all of that in one.
No other external components are needed for its application because all
necessary peripherals are already built into it.
Thus, we save the time and space needed to construct devices.
Microcontroller
A microcontroller is a microprocessor designed to perform simple control functions.
Microcontrollers usually have these features
• low cost,
• physically small,
• input/output intensive, and capable of easy interfacing,
• limited memory capability for program and data,
• instruction set leading to compact code, with limited arithmetic capability,
• ability to operate in a real-time environment.
In certain applications the following further features are essential:
• ability to operate in hostile environment, e.g. high or low temperature, tolerant to
electromagnetic interference,
• low power, with features adapted to battery power.
Microcontroller
A microcontroller = microprocessor core + memory + peripherals
Digital
Program
I/0
Microprocessor
Data
Memory
Memory
Core
Analog
I/0
& Timers
Counters
Reset
Power
Clock
Address Buses
Internal Data &
Further
Peripheral
Further
Peripheral
Interrupt(s)
Microcontroller
PIC is a family of microcontrollers made by Microchip Technology.
The original one was the PIC1650 developed by General Instruments.
This device was called:
PIC for “Programmable Intelligent Computer” although it is now associated with
“Programmable Interface Controller.”
Microchip does not use PIC as brand name . Instead they prefer the
brand name PICmicro.
PIC is a registered brand in Germany and Microchip is unable to use it
internationally.
Microcontroller
The original PIC was built to be used with General Instruments’ CP1600 processor,
which had poor I/O performance.
The PIC was designed to take over the I/O tasks for the CPU, thus improving
performance.
In 1985, the PIC was upgraded with EPROM to produce a programmable controller.
Today, a huge variety of PICs are available with many different on-board
peripherals and program memories ranging from a few hundred words to 32K.
Microcontroller
PICs use an instruction set that varies in length from about 35 instructions for the
low-end PICs to more than 70 for the high-end devices.
The PICs are programmable in their native Assembly Language, which is
straightforward and not difficult to learn.
In addition, C language and BASIC compilers have been developed for the PIC.
Open-source Pascal, JAL, and Forth compilers are also available for PIC
programming.
Microcontroller interface
Input
Variables
Output
(User Interface)
Variables
(Link to other Systems)
Embedded Computer
Software
Hardware
Signal
Conditioning
Data
Conversion
Output
Drive
(display, keypad etc.)
Microcontroller applications
Microcontroller
Electronics
Electric Motors &
Computer Architecture
Software Engineering
Integrated Circuit
Design
Digital
Analogue
Electronics
Actuators
Sensors and
Measurements
Control
Engineering
Data
Communications
PIC Microcontroller Architecture
a) The Von Neumann Way b) The Harvard Way
Data
Memory
Program
Memory
Address
Data
Central
Processing
Unit (CPU)
Input/
Output
Central
Processing
Unit (CPU)
Data
Memory
Input/
Output
Program
Memory
Address
Data
Address
Data
Address
Data
Instructions and Instruction Sets
Increment A
Decrement A
Add A to M
Subtract M from A
AND A with M
OR A with M
Exclusive OR A with M
Shift A left
Shift A right
Rotate A left
Rotate A right
Complement A
Clear A
A = A plus 1
A = A - 1
A = A plus M
A = A - M
A = A.M
A = A + M
A = A M
+
A = 2A
A = A/2
A = NOT A
A = 0
A computer “executes” instructions in its Arithmetic Logic Unit (ALU), running through a series of
instructions called a program. An ALU can only do a few things, but it can do them very fast. A
typical 8-bit ALU can do the list shown below. A is the “Accumulator”, a digital register where the
computations actually occur, and M is a location in memory. The ALU in turn forms part of the
Central Processing Unit (CPU).
How Instruction Sets are Made: the “CISC” Machine
Any CPU has a set of instructions that it recognizes and responds to; all programs
are built up in one way or another from this instruction set. We want computers to
execute code as fast as possible, but how to achieve this aim is not always an obvious
matter.
One approach is to build sophisticated CPUs with exotic instruction sets, with an
instruction ready for every foreseeable operation. This leads to the CISC, the
Complex Instruction Set Computer. A CISC has many instructions, and considerable
sophistication. Yet the complexity of the design needed to achieve this tends to lead
to slow operation. One characteristic of the CISC approach is that instructions have
different levels of complexity. Simple ones can be expressed in a short instruction
code, say one byte of data, and execute quickly. Complex ones may need several
bytes of code to define them, and take a long time to execute.
A CISC machine is generally recognised by:
• Many instructions (say over one hundred), some with considerable sophistication;
• Instruction words are of different length;
• Instructions take different lengths of time to execute.
How Instruction Sets are Made: the “RISC” Machine
Another approach is to keep the CPU very simple, and have a limited instruction
set. This leads to the RISC approach – the Reduced Instruction Set Computer. The
instruction set, and hence overall design, is kept simple. This leads to fast operation.
One characteristic of the RISC approach is that each instruction is contained within
a single binary word. That word must hold all information necessary, including the
instruction code itself, as well as any address or data information also needed. A
further characteristic, an outcome of the simplicity of the approach, is that every
instruction normally takes the same amount of time to execute.
A RISC machine is generally recognised by:
• Few instructions (say well below one hundred),
• Each performs a very simple action;
• All instructions are single word;
• All, or almost all instructions take the same length of time to execute.
PIC 16F84A Microcontroller
The 16F84A is available as an 18-pin device. The pin connection diagram is
shown here. This won’t make much sense just yet, but in the coming sessions you
will be surprised how quickly you get to know what most (if not all) of these pins
are used for.
RA2
RA3
RA4/T0CKI
MCLR
V
RB0/INT
RB1
RB2
RB3 RB4
RB5
RB6
RB7
RA1
RA0
OSC1/CLKIN
OSC2/CLKOUT
VDD
SS Supply voltage
Oscillator connections
Port A, Bit 0
Port A, Bit 1
Port A, Bit 2
Port A, Bit 3
*Port A, Bit 4
Ground
**Port B, Bit 0
Port B, Bit 1
Port B, Bit 2
Port B, Bit 3
Port B, Bit 7
Port B, Bit 6
Port B, Bit 5
Port B, Bit 4
*also Counter/Timer clock input
**also external Interrupt input
Reset
1
9 10
18
PIC 16F84A Microcontroller
We are going to look at the block diagram of the 16F84A, straight from the
manufacturer’s data sheet, shown below right. A good understanding of the block
diagram leads to an ability to design with the microcontroller, and to program it.
In the diagram, you should in time be able to recognise all the basic features of a
microcontroller. Let’s pick out the main features of the 16F84A, in the coming slides.
Digital
Program
I/0
Microprocessor
Data
Memory
Memory
Core
Analog
I/0
& Timers
Counters
Reset
Power
Clock
Address Buses
Internal Data &
Further
Peripheral
Further
Peripheral
Interrupt(s)
PIC 16F84A Microcontroller: Block diagram
The CPU
Address for Program Memory
Data from
Program
Memory,
carrying
instruction
word
Address for Data
Memory
Data bus for
Data Memory
and peripherals
Program Memory
Data
Memory
Extra “non-
volatile” Data
Memory
Counter/Timer
Peripheral
Digital Input/
Output Ports
PIC 16F84A Microcontroller: “Flow“
The Instruction word
flows here. The word will
contain the instruction, and
maybe also address and
data information
Address info.
flows here
Instruction info
flows here
The core is the “microprocessor
inside the microcontroller”,
centred around the ALU. It is
interesting to see the path that the
instruction takes from program
memory.
“Literal” data
flows along here
The Arithmetic
Logic Unit
The “Working
Register”
PIC 16F84A Microcontroller: Block diagram
Program Memory and Stack
Program
Counter
16 Series
instructions which
invoke the Stack
Unimplemented memory
space, still addressable by
the 13-bit 16F84A program
address bus.
Program Counter
points to locations in
program memory
The program
must start here
The Interrupt
Service Routine
must start here
Interfacing with Peripherals – the Special Function Register
Control SFR(s)
Peripheral
Data Transfer SFR(s)
Microcontroller
Core
"Outside
World"
Interrupt(s)
Microcontroller Interaction with its Peripherals, via Special Function Register (SFR) and Interrupt
 microcontroller peripherals can be configured in software to operate in a number of different
modes, to do this certain control data must be sent to them to set them up in the desired way
 once in use, there will be data flow between core and peripheral,
 there may still be need for further control data,
 these needs are commonly met by means of dedicated, memory - mapped registers, sometimes
called Special Function Registers,
 this approach gives the microcontroller manufacturer great flexibility to extend a microcontroller
family – SFRs for new peripherals can easily be located in gaps in the memory map.
Data Memory and Special Function Register Map
msb is “bank
select bit”
(Status register).
These are the Special Function
Registers, which allow the CPU
to interact with the peripherals
General purpose memory

More Related Content

What's hot (20)

PDF
Simatic getting-started-pcs7
ionut grozav
 
PPT
Introduction to the 16-bit PIC24F Microcontroller Family
Premier Farnell
 
PPTX
Intro
Mohamed Rayan
 
PPTX
Computer Application in Power system chapter one - introduction
Adama Science and Technology University
 
PPTX
Superscalar Processor
Manash Kumar Mondal
 
PDF
Digital signal processing based on motor control ppt
boga manisha
 
PDF
Microprocessor and Microcontroller - ITVoyagers
ITVoyagers
 
PDF
Speed Control Of DC motor By Using PWM Technique
RITESH D. PATIL
 
PPTX
4 bit Binary counter
Jainee Solanki
 
PPTX
Controller Area Network(CAN)
Ashutosh Bhardwaj
 
PPTX
8085 architecture
Rishabh Kataria
 
PPTX
Design of control unit.pptx
Shubham014
 
PPTX
Powerpoint Presentation on Series Reactors
Suresh Mohta
 
PPTX
Unit 5 series motor (universal)motors
Er.Meraj Akhtar
 
PPTX
Unit 4 Automatic Generation Control
SANTOSH GADEKAR
 
DOCX
Applications of 8051 microcontrollers
Dr.YNM
 
PPTX
Speed control of dc motor using chopper
Ajeeta Srivastava
 
PDF
Unit-I Basic Embedded System Notes
Dr. Pankaj Zope
 
PPTX
Timer programming for 8051 using embedded c
Vikas Dongre
 
PPTX
Microprocessor applications
Rohit Gothwal
 
Simatic getting-started-pcs7
ionut grozav
 
Introduction to the 16-bit PIC24F Microcontroller Family
Premier Farnell
 
Computer Application in Power system chapter one - introduction
Adama Science and Technology University
 
Superscalar Processor
Manash Kumar Mondal
 
Digital signal processing based on motor control ppt
boga manisha
 
Microprocessor and Microcontroller - ITVoyagers
ITVoyagers
 
Speed Control Of DC motor By Using PWM Technique
RITESH D. PATIL
 
4 bit Binary counter
Jainee Solanki
 
Controller Area Network(CAN)
Ashutosh Bhardwaj
 
8085 architecture
Rishabh Kataria
 
Design of control unit.pptx
Shubham014
 
Powerpoint Presentation on Series Reactors
Suresh Mohta
 
Unit 5 series motor (universal)motors
Er.Meraj Akhtar
 
Unit 4 Automatic Generation Control
SANTOSH GADEKAR
 
Applications of 8051 microcontrollers
Dr.YNM
 
Speed control of dc motor using chopper
Ajeeta Srivastava
 
Unit-I Basic Embedded System Notes
Dr. Pankaj Zope
 
Timer programming for 8051 using embedded c
Vikas Dongre
 
Microprocessor applications
Rohit Gothwal
 

Similar to Microprocessor and Microcontroller Based Systems.ppt (20)

PPTX
MergeResult_2023_04_02_05_26_56.pptx
bhaveshagrawal35
 
PDF
Microcontroller pic 16f877 architecture and basics
Nilesh Bhaskarrao Bahadure
 
PDF
Unit I_MT2301.pdf
Kannan Kanagaraj
 
DOCX
8051 microcontroller
snehapvs
 
PPTX
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
MeghdeepSingh
 
PDF
VTU University Micro Controllers-06ES42 lecturer Notes
24x7house
 
PDF
MC_Module_1 (2).pdf MICROCONTROLLER VTU. MODULE 2
ssuser8f6b1d1
 
PPTX
M&i(lec#01)
Majid Mehmood
 
PPTX
Project report on embedded system using 8051 microcontroller
Vandna Sambyal
 
PPTX
AEC 8051 controller.pptxmicrocontroller notes
samarthwali91
 
PPTX
MICRO-PROCESSORS and MICRO -CONTROLLER topic
adofficials07
 
DOCX
embeddeed real time systems 2 mark questions and answers
rubini Rubini
 
PPTX
Alisksdjdhdhhdhdhdhdhhdhdheheksjsjs.pptx
ssuser07a9781
 
PPTX
Micro controller and dsp processor
ShubhamMishra485
 
PPTX
Presentation for EEE engineers on Microcontroller by Dilip Kumar Roy
Dilip Kumar Ckt
 
PPT
EEE226a.ppt
SaifulAhmad27
 
PDF
Lecture 5-Embedde.pdf
BlackHunter13
 
PPTX
Introduction to Embedded Systems and Microcontrollers
Islam Samir
 
PPTX
Unit-1.pptx
sidhantkulkarni1
 
PPTX
Introduction to Microcontroller
Nikhil Sharma
 
MergeResult_2023_04_02_05_26_56.pptx
bhaveshagrawal35
 
Microcontroller pic 16f877 architecture and basics
Nilesh Bhaskarrao Bahadure
 
Unit I_MT2301.pdf
Kannan Kanagaraj
 
8051 microcontroller
snehapvs
 
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
MeghdeepSingh
 
VTU University Micro Controllers-06ES42 lecturer Notes
24x7house
 
MC_Module_1 (2).pdf MICROCONTROLLER VTU. MODULE 2
ssuser8f6b1d1
 
M&i(lec#01)
Majid Mehmood
 
Project report on embedded system using 8051 microcontroller
Vandna Sambyal
 
AEC 8051 controller.pptxmicrocontroller notes
samarthwali91
 
MICRO-PROCESSORS and MICRO -CONTROLLER topic
adofficials07
 
embeddeed real time systems 2 mark questions and answers
rubini Rubini
 
Alisksdjdhdhhdhdhdhdhhdhdheheksjsjs.pptx
ssuser07a9781
 
Micro controller and dsp processor
ShubhamMishra485
 
Presentation for EEE engineers on Microcontroller by Dilip Kumar Roy
Dilip Kumar Ckt
 
EEE226a.ppt
SaifulAhmad27
 
Lecture 5-Embedde.pdf
BlackHunter13
 
Introduction to Embedded Systems and Microcontrollers
Islam Samir
 
Unit-1.pptx
sidhantkulkarni1
 
Introduction to Microcontroller
Nikhil Sharma
 
Ad

More from TALHARIAZ46 (8)

PPT
Introduction to Microprocessor .ppt
TALHARIAZ46
 
PPT
Microprocessor Based Systems.ppt
TALHARIAZ46
 
PPTX
Microbial-Food-Safety.pptx
TALHARIAZ46
 
PPTX
Industrial Control System.pptx
TALHARIAZ46
 
PPTX
Industrial Control System.pptx
TALHARIAZ46
 
PPTX
Food Safety Presentation.pptx
TALHARIAZ46
 
PPTX
Industrial Control Devices.pptx
TALHARIAZ46
 
PPT
AI.ppt
TALHARIAZ46
 
Introduction to Microprocessor .ppt
TALHARIAZ46
 
Microprocessor Based Systems.ppt
TALHARIAZ46
 
Microbial-Food-Safety.pptx
TALHARIAZ46
 
Industrial Control System.pptx
TALHARIAZ46
 
Industrial Control System.pptx
TALHARIAZ46
 
Food Safety Presentation.pptx
TALHARIAZ46
 
Industrial Control Devices.pptx
TALHARIAZ46
 
AI.ppt
TALHARIAZ46
 
Ad

Recently uploaded (20)

PDF
輪読会資料_Miipher and Miipher2 .
NABLAS株式会社
 
PPTX
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
moonsony54
 
PPTX
CST413 KTU S7 CSE Machine Learning Clustering K Means Hierarchical Agglomerat...
resming1
 
PPTX
Functions in Python Programming Language
BeulahS2
 
PPTX
FSE_LLM4SE1_A Tool for In-depth Analysis of Code Execution Reasoning of Large...
cl144
 
PDF
Rapid Prototyping for XR: Lecture 5 - Cross Platform Development
Mark Billinghurst
 
PDF
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
AlqualsaDIResearchGr
 
PPTX
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
AsadShad4
 
PPTX
Mobile database systems 20254545645.pptx
herosh1968
 
PDF
Decision support system in machine learning models for a face recognition-bas...
TELKOMNIKA JOURNAL
 
PPTX
CST413 KTU S7 CSE Machine Learning Introduction Parameter Estimation MLE MAP ...
resming1
 
PDF
01-introduction to the ProcessDesign.pdf
StiveBrack
 
PPTX
Kel.3_A_Review_on_Internet_of_Things_for_Defense_v3.pptx
Endang Saefullah
 
PPTX
Work at Height training for workers .pptx
cecos12
 
PDF
June 2025 Top 10 Sites -Electrical and Electronics Engineering: An Internatio...
elelijjournal653
 
PDF
Rapid Prototyping for XR: Lecture 3 - Video and Paper Prototyping
Mark Billinghurst
 
PDF
Validating a Citizen Observatories enabling Platform by completing a Citizen ...
Diego López-de-Ipiña González-de-Artaza
 
PPTX
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 
PPTX
Comparison of Flexible and Rigid Pavements in Bangladesh
Arifur Rahman
 
PPTX
LECTURE 7 COMPUTATIONS OF LEVELING DATA APRIL 2025.pptx
rr22001247
 
輪読会資料_Miipher and Miipher2 .
NABLAS株式会社
 
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
moonsony54
 
CST413 KTU S7 CSE Machine Learning Clustering K Means Hierarchical Agglomerat...
resming1
 
Functions in Python Programming Language
BeulahS2
 
FSE_LLM4SE1_A Tool for In-depth Analysis of Code Execution Reasoning of Large...
cl144
 
Rapid Prototyping for XR: Lecture 5 - Cross Platform Development
Mark Billinghurst
 
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
AlqualsaDIResearchGr
 
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
AsadShad4
 
Mobile database systems 20254545645.pptx
herosh1968
 
Decision support system in machine learning models for a face recognition-bas...
TELKOMNIKA JOURNAL
 
CST413 KTU S7 CSE Machine Learning Introduction Parameter Estimation MLE MAP ...
resming1
 
01-introduction to the ProcessDesign.pdf
StiveBrack
 
Kel.3_A_Review_on_Internet_of_Things_for_Defense_v3.pptx
Endang Saefullah
 
Work at Height training for workers .pptx
cecos12
 
June 2025 Top 10 Sites -Electrical and Electronics Engineering: An Internatio...
elelijjournal653
 
Rapid Prototyping for XR: Lecture 3 - Video and Paper Prototyping
Mark Billinghurst
 
Validating a Citizen Observatories enabling Platform by completing a Citizen ...
Diego López-de-Ipiña González-de-Artaza
 
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 
Comparison of Flexible and Rigid Pavements in Bangladesh
Arifur Rahman
 
LECTURE 7 COMPUTATIONS OF LEVELING DATA APRIL 2025.pptx
rr22001247
 

Microprocessor and Microcontroller Based Systems.ppt

  • 1. Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical Engineering Department ‫الرحيم‬ ‫الرحمن‬ ‫هللا‬ ‫بسم‬ Lecture 3 EELE 4315 — Fall 2010
  • 3. Microcontroller Microcontroller differs from a microprocessor in many ways. First and the most important is its functionality. In order for a microprocessor to be used, other components such as memory, or components for receiving and sending data must be added to it. On the other hand, microcontroller is designed to be all of that in one. No other external components are needed for its application because all necessary peripherals are already built into it. Thus, we save the time and space needed to construct devices.
  • 4. Microcontroller A microcontroller is a microprocessor designed to perform simple control functions. Microcontrollers usually have these features • low cost, • physically small, • input/output intensive, and capable of easy interfacing, • limited memory capability for program and data, • instruction set leading to compact code, with limited arithmetic capability, • ability to operate in a real-time environment. In certain applications the following further features are essential: • ability to operate in hostile environment, e.g. high or low temperature, tolerant to electromagnetic interference, • low power, with features adapted to battery power.
  • 5. Microcontroller A microcontroller = microprocessor core + memory + peripherals Digital Program I/0 Microprocessor Data Memory Memory Core Analog I/0 & Timers Counters Reset Power Clock Address Buses Internal Data & Further Peripheral Further Peripheral Interrupt(s)
  • 6. Microcontroller PIC is a family of microcontrollers made by Microchip Technology. The original one was the PIC1650 developed by General Instruments. This device was called: PIC for “Programmable Intelligent Computer” although it is now associated with “Programmable Interface Controller.” Microchip does not use PIC as brand name . Instead they prefer the brand name PICmicro. PIC is a registered brand in Germany and Microchip is unable to use it internationally.
  • 7. Microcontroller The original PIC was built to be used with General Instruments’ CP1600 processor, which had poor I/O performance. The PIC was designed to take over the I/O tasks for the CPU, thus improving performance. In 1985, the PIC was upgraded with EPROM to produce a programmable controller. Today, a huge variety of PICs are available with many different on-board peripherals and program memories ranging from a few hundred words to 32K.
  • 8. Microcontroller PICs use an instruction set that varies in length from about 35 instructions for the low-end PICs to more than 70 for the high-end devices. The PICs are programmable in their native Assembly Language, which is straightforward and not difficult to learn. In addition, C language and BASIC compilers have been developed for the PIC. Open-source Pascal, JAL, and Forth compilers are also available for PIC programming.
  • 9. Microcontroller interface Input Variables Output (User Interface) Variables (Link to other Systems) Embedded Computer Software Hardware Signal Conditioning Data Conversion Output Drive (display, keypad etc.)
  • 10. Microcontroller applications Microcontroller Electronics Electric Motors & Computer Architecture Software Engineering Integrated Circuit Design Digital Analogue Electronics Actuators Sensors and Measurements Control Engineering Data Communications
  • 11. PIC Microcontroller Architecture a) The Von Neumann Way b) The Harvard Way Data Memory Program Memory Address Data Central Processing Unit (CPU) Input/ Output Central Processing Unit (CPU) Data Memory Input/ Output Program Memory Address Data Address Data Address Data
  • 12. Instructions and Instruction Sets Increment A Decrement A Add A to M Subtract M from A AND A with M OR A with M Exclusive OR A with M Shift A left Shift A right Rotate A left Rotate A right Complement A Clear A A = A plus 1 A = A - 1 A = A plus M A = A - M A = A.M A = A + M A = A M + A = 2A A = A/2 A = NOT A A = 0 A computer “executes” instructions in its Arithmetic Logic Unit (ALU), running through a series of instructions called a program. An ALU can only do a few things, but it can do them very fast. A typical 8-bit ALU can do the list shown below. A is the “Accumulator”, a digital register where the computations actually occur, and M is a location in memory. The ALU in turn forms part of the Central Processing Unit (CPU).
  • 13. How Instruction Sets are Made: the “CISC” Machine Any CPU has a set of instructions that it recognizes and responds to; all programs are built up in one way or another from this instruction set. We want computers to execute code as fast as possible, but how to achieve this aim is not always an obvious matter. One approach is to build sophisticated CPUs with exotic instruction sets, with an instruction ready for every foreseeable operation. This leads to the CISC, the Complex Instruction Set Computer. A CISC has many instructions, and considerable sophistication. Yet the complexity of the design needed to achieve this tends to lead to slow operation. One characteristic of the CISC approach is that instructions have different levels of complexity. Simple ones can be expressed in a short instruction code, say one byte of data, and execute quickly. Complex ones may need several bytes of code to define them, and take a long time to execute. A CISC machine is generally recognised by: • Many instructions (say over one hundred), some with considerable sophistication; • Instruction words are of different length; • Instructions take different lengths of time to execute.
  • 14. How Instruction Sets are Made: the “RISC” Machine Another approach is to keep the CPU very simple, and have a limited instruction set. This leads to the RISC approach – the Reduced Instruction Set Computer. The instruction set, and hence overall design, is kept simple. This leads to fast operation. One characteristic of the RISC approach is that each instruction is contained within a single binary word. That word must hold all information necessary, including the instruction code itself, as well as any address or data information also needed. A further characteristic, an outcome of the simplicity of the approach, is that every instruction normally takes the same amount of time to execute. A RISC machine is generally recognised by: • Few instructions (say well below one hundred), • Each performs a very simple action; • All instructions are single word; • All, or almost all instructions take the same length of time to execute.
  • 15. PIC 16F84A Microcontroller The 16F84A is available as an 18-pin device. The pin connection diagram is shown here. This won’t make much sense just yet, but in the coming sessions you will be surprised how quickly you get to know what most (if not all) of these pins are used for. RA2 RA3 RA4/T0CKI MCLR V RB0/INT RB1 RB2 RB3 RB4 RB5 RB6 RB7 RA1 RA0 OSC1/CLKIN OSC2/CLKOUT VDD SS Supply voltage Oscillator connections Port A, Bit 0 Port A, Bit 1 Port A, Bit 2 Port A, Bit 3 *Port A, Bit 4 Ground **Port B, Bit 0 Port B, Bit 1 Port B, Bit 2 Port B, Bit 3 Port B, Bit 7 Port B, Bit 6 Port B, Bit 5 Port B, Bit 4 *also Counter/Timer clock input **also external Interrupt input Reset 1 9 10 18
  • 16. PIC 16F84A Microcontroller We are going to look at the block diagram of the 16F84A, straight from the manufacturer’s data sheet, shown below right. A good understanding of the block diagram leads to an ability to design with the microcontroller, and to program it. In the diagram, you should in time be able to recognise all the basic features of a microcontroller. Let’s pick out the main features of the 16F84A, in the coming slides. Digital Program I/0 Microprocessor Data Memory Memory Core Analog I/0 & Timers Counters Reset Power Clock Address Buses Internal Data & Further Peripheral Further Peripheral Interrupt(s)
  • 17. PIC 16F84A Microcontroller: Block diagram The CPU Address for Program Memory Data from Program Memory, carrying instruction word Address for Data Memory Data bus for Data Memory and peripherals Program Memory Data Memory Extra “non- volatile” Data Memory Counter/Timer Peripheral Digital Input/ Output Ports
  • 18. PIC 16F84A Microcontroller: “Flow“ The Instruction word flows here. The word will contain the instruction, and maybe also address and data information Address info. flows here Instruction info flows here The core is the “microprocessor inside the microcontroller”, centred around the ALU. It is interesting to see the path that the instruction takes from program memory. “Literal” data flows along here The Arithmetic Logic Unit The “Working Register”
  • 20. Program Memory and Stack Program Counter 16 Series instructions which invoke the Stack Unimplemented memory space, still addressable by the 13-bit 16F84A program address bus. Program Counter points to locations in program memory The program must start here The Interrupt Service Routine must start here
  • 21. Interfacing with Peripherals – the Special Function Register Control SFR(s) Peripheral Data Transfer SFR(s) Microcontroller Core "Outside World" Interrupt(s) Microcontroller Interaction with its Peripherals, via Special Function Register (SFR) and Interrupt  microcontroller peripherals can be configured in software to operate in a number of different modes, to do this certain control data must be sent to them to set them up in the desired way  once in use, there will be data flow between core and peripheral,  there may still be need for further control data,  these needs are commonly met by means of dedicated, memory - mapped registers, sometimes called Special Function Registers,  this approach gives the microcontroller manufacturer great flexibility to extend a microcontroller family – SFRs for new peripherals can easily be located in gaps in the memory map.
  • 22. Data Memory and Special Function Register Map msb is “bank select bit” (Status register). These are the Special Function Registers, which allow the CPU to interact with the peripherals General purpose memory