2. What is Microcontroller?
Microcontroller is a
single chip
self-contained computer
single chip devices or single chip computers.
A programmable single chip which controls a process or
system.
Integrated circuit with pins along each side.
Microcontrollers are used in appliances, automobile,
scientific instrument etc..,
2
3. Difference between Microcontroller
and Microprocessor
A microcontroller is not the same as a microprocessor.
A microprocessor is a single chip CPU used within other
computer systems. A microcontroller is itself a single chip
computer system.
3
4. Components
A microcontroller has seven
main components:
Central processing unit (CPU)
ROM
RAM
Input and Output
Timer
Interrupt circuitry
Buses
4
5. Architecture
There are two basic types of architecture:
Harvard
Von Neumann.
Microcontrollers most often use a Harvard or a modified
Harvard-based architecture.
5
6. Von Neumann
Von Neumann architecture has a single, common memory
space where both program instructions and data are stored.
There is a single data bus which fetches both instructions
and data.
The advantage to this architecture lies in its simplicity and
economy.
6
7. Harvard Architecture
Harvard architecture computers have separate memory areas
for program instructions and data.
There are two or more internal data buses which allow
simultaneous access to both instructions and data.
This speeds up execution time at the cost of more hardware
complexity.
7
8. The Central Processing Unit
The central processing unit (CPU) does all the computing.
It fetches, decodes and executes program instructions and
directs the flow of data to and from memory.
The CPU performs the calculations required by program
instructions and places the results of these calculations, if
required, into memory space.
8
10. Contd..,
Arithmetic logic unit, or ALU: One part of the CPU is
responsible for performing calculations and executing
instructions. ALU contains the decoder, the sequencer and a
variety of registers.
Decoder: It converts instructions stored in program memory
into codes which the ALU can understand.
Sequencer: It manages the flow of data along the
microcontroller’s data bus.
Registers: It temporarily store vital data which are volatile:
they can change during program execution.
10
11. Registers
The stack pointer: The stack pointer contains the address of
the next location on the stack. The address in the stack
pointer is decremented when data is pushed on the stack and
incremented when data is popped from the stack.
The index register: The index register is used to specify an
address when certain addressing modes are used.
11
12. Contd..,
The program counter: The PC holds the address of the
next instruction in program memory space. It contains the
address of the next instruction the CPU will process. As each
instruction is fetched and processed by the ALU, the CPU
increments the PC.
The accumulator: The accumulator is a register that can
hold operands or results of operations as necessary. The
Microchip devices use the name W (working) register.
12
13. ROM
ROM, read only memory, is non-volatile memory used for
program information and permanent data.
The microcontroller uses ROM memory space to store
program instructions it will execute when it is started or
reset.
13
14. RAM
RAM, random access memory, is used to write and read
data values as a program runs.
RAM is volatile: if you remove the power supply its
contents are lost. Any variables used in a program are
allocated from RAM.
14
15. I/O Ports
There are two main port types, parallel and serial, and two
port modes,synchronous and asynchronous.
Parallel I/O requires a data line for each bit,while serial I/O
uses a single line and transfers bits in sequence.
Synchronous I/O is synchronised to a clock while
asynchronous I/O is not.
15
16. Timer
A timer is a counter that is incremented at a fixed rate when
the system clock pulses.
A timer/counter can perform several different tasks. The
CPU uses the timer to keep track of time accurately.
The timer can generate a stream of pulses or a single pulse at
different frequencies. It can be used to start and stop tasks at
desired times.
16
17. Interrupt Circuitry
An interrupt is an event that suspends regular program
operation while the event is serviced by another program.
Interrupts increase the response speed to external events.
When an interrupt is received current operation is
suspended, the interrupt is identified and the controller
jumps (vectors) to an interrupt service routine.
There are two sources of interrupt: hardware and software.
Hardware interrupts include a signal to a pin, timer
overflow, and serial port interrupts. Software interrupts are
commands given by the programmer,
17