3. OUTLINE
1) Embedded system and general purpose systems
2) What is microcontroller?
3) What are different types of microcontroller?
4) How to select controller for a given application?
5) Applications..
4. EMBEDDED SYSTEM AND
GENERAL PURPOSE COMPUTERS
System:-
A system is an arrangement in which all its unit assemble
work together according to a set of rules. It can also be
defined as a way of working, organizing or doing one or
many tasks according to a fixed plan.
For example, a watch is a time displaying system.
If one of its parts fails, the watch will stop working. So we can say, in
a system, all its subcomponents depend on each other.
5. EMBEDDED SYSTEM
⢠Embedded means something that is attached to another thing.
⢠An embedded system can be thought of as a computer hardware
system having software embedded in it.
⢠An embedded system can be an independent system or it can be
a part of a large system.
⢠An embedded system is a microcontroller or microprocessor
based system which is designed to perform a specific task.
⢠For example, a fire alarm is an embedded system; it will sense
only smoke.
6.
7.
8. ⢠An embedded system has three components â
⢠It has hardware.
⢠It has application software.
⢠It has Real Time Operating system (RTOS)
⢠RTOS defines the way the system works. It sets the rules
during the execution of application program.
⢠A small scale embedded system may not have RTOS.
9.
10. INTRODUCTION TO
MICROCONTROLLERS
â˘Microprocessor = CPU on a single
chip.
â˘> ALU + registers + control +âŚ
â˘Micro-computer = small computer
â˘uP + I/O + memory + peripheral +
âŚ
⢠Microcontroller (uC)
11. A Microprocessor System
Contains the same 6 basic components:
âArithmetic logic unit (ALU)
âRegister array
âControl unit
âMemory
âInput unit
âOutput unit
Basic Microprocessor Systems
12. MICROPROCESSOR
⢠Microprocessor: a CPU on a single
integrated chip (IC)
⢠a special type of CPU
⢠The brain of a computer
⢠E.g.:
⢠â 8086, 80286, 80386, 80486,
Pentium, Core 2 Duo, Core 2
Quad, K5, K6, Atholon, Atholon
64, Opteron, Phenon, PowerPC
G4, PowerPC G5, Xenon,
Broadway, Cell, âŚ
⢠Contains no RAM, no ROM, no I/O
ports on chip.
14. MICROCONTROLLER :
⢠A microprocessor, and RAM, ROM, I/O ports, and
timer on a single chip. Also called MCU
(MicroController Unit)
⢠, uC
⢠âComputer on a chipâ
⢠Usually not as powerful as general purpose
microprocessor
⢠Low power consumption, small in size, low cost.
⢠A lot of MCUs are application specific (as against
the general purpose microprocessor).ÎźC
15. DIFFERENCE BETWEEN ÎP AND ÎC
Sr. No
ÂľP ÂľC
1 Several Instructions for moving Data from
external memory to CPU.
One or two instructions for
moving the data from
external memory to CPU.
2 In ÂľP few pins are multi functioned. In ÂľC large number of
pins are multi
functioned.
3 Designer can decide on the amount of
ROM, RAM and I/O ports.
Fixed program and data
memory.
4 Uses different ICs for memory and I/O Inbuilt Memory and I/O.
5 No Inbuilt timer. Inbuilt timer is there.
16.
17. 1. Meeting the computing needs of the task efficiently and
cost effectively
⢠speed, the amount of ROM and RAM, the number of
I/O ports and timers, size, packaging, power
consumption
⢠easy to upgrade
⢠cost per unit
2. Availability of software development tools
⢠assemblers, debuggers, C compilers, emulator,
simulator, technical support
3. Wide availability and reliable sources of the
microcontrollers.
Three criteria in Choosing a Microcontroller
18. â Speed
â Power consumption
â Amount of RAM and ROM on chip
â Number of I/O pins
â Cost per unit
â Packaging
HOW DO WE DECIDE WHICH MCU TO
USE?
21. BASIC MICROPROCESSOR
SYSTEMS
Architecture uses physically separate memories for
their instructions and data, requiring dedicated buses
for each of them. Instructions and operands can
therefore be fetched simultaneously.
Different program and data bus widths are possible,
allowing program and data memory to be better
optimized to the architectural requirements.
E.g.: If the instruction format requires 14 bits then program bus
and memory can be made 14-bit wide, while the data bus and
data memory remain 8-bit wide.
22. IF A DEVICE OR AN APPLICATION INVOLVES
MEASURING, STORING, CALCULATING,
CONTROLLING OR DISPLAYING INFORMATION,
THEN DEVICE CONTAINS A MICROCONTROLLER IN
IT.
24. Brief History of 8051
⢠The first microprocessor 4004 was invented by Intel
Corporation.
⢠8085 and 8086 microprocessors were also invented
by Intel.
⢠In 1981, Intel introduced an 8-bit microcontroller
called the 8051.
⢠It was referred as system on a chip because it had
128 bytes of RAM, 4K byte of on-chip ROM, two
timers, one serial port, and 4 ports (8-bit wide), all on
a single chip.
25. 8051 BASIC COMPONENT
⢠Central Processing Unit (CPU)
⢠Program Memory (ROM â Read Only Memory)
⢠Data Memory (RAM â Random Access Memory)
⢠Timers and Counters
⢠I/O Ports (I/O â Input/Output)
⢠Serial Communication Interface
⢠Clock Circuit (Oscillator Circuit)
⢠Interrupt Mechanism
RAM
I/O
Port
counter
Timer
Serial
COM
Port
Microcontroller
CPU
A single chip
ROM
28. BASIC COMPONENTS PRESENT INSIDE
8051 MICROCONTROLLER
ARCHITECTURE ARE:
1. CPU (Central Processing Unit):
⢠CPU act as a mind of any processing machine. It synchronizes and
manages all processes that are carried out in microcontroller.
⢠It interprets the program stored in ROM and carries out from storage and
then performs it projected duty.
⢠CPU manage the different types of registers available in 8051
microcontroller.
2. Interrupts: Interrupts is a sub-routine call that given by the
microcontroller when some other program with high priority is request for
acquiring the system buses then interrupts occur in current running
program.
29. ⢠interrupts provide a method to postpone or delay the current
process, performs a sub-routine task and then restart the
standard program again.
Types of interrupt in 8051 Microcontroller:
The five sources of interrupts in 8051 Microcontroller:
1) Timer 0 overflow interrupt - TF0
2) Timer 1 overflow interrupt - TF1
3) External hardware interrupt - INT0
4) External hardware interrupt - INT1
5) Serial communication interrupt - RI/TI
30. MEMORY:
1. For operation Micro-controller required a program.
2. This program guides the microcontroller to perform the specific
tasks.
3. This program installed in microcontroller required some on chip
memory for the storage of the program.
4. Microcontroller also required memory for storage of data and
operands for the short duration.
5. In microcontroller 8051 there is code or program memory of 4 KB
that is it has 4 KB ROM and it also comprise of data memory
(RAM) of 128 bytes.
31. BUS :
1. Bus is a group of wires which uses as a
communication canal or acts as means of
data transfer.
2. The different bus configuration includes 8,
16 or more cables. Therefore, a bus can
bear 8 bits, 16 bits all together.
32. ⢠Timers/Counters
⢠Timers are used to create a time gap or delay between two events.
⢠The timer produces the delay according to the demand of the processor and sends the signal to the
processor once the respective delay gets produced.
⢠As the microcontroller is digital circuit therefore it needs timer for their operation.
⢠Oscillator:
⢠To perform timer operation inside microcontroller it required 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 timers and counters the oscillator is used inside microcontroller.
33. ⢠Input/Output Port
⢠8051 consists of 4 parallel ports of 8 bit each thereby providing
32 input-output pins.
⢠All the 4 ports function bidirectionally i.e., either input or
output according to the software control.
34. ACCUMULATOR
⢠ACC is the accumulator register. It holds most of the
results of mathematical and logical operations of the
8051.
⢠It is also used for all data transfer between the 8051 and
any external memory.
Register B
The register B is Used during multiply and divide
operations.
Serial Data Buffer
When transmitting data ,it holds the data to be
transmitted and while receiving ,it holds the receiving
data.
35. 1. An 8-bit CPU with two registers A (ACC or accumulator) and B
2. Internal Flash ROM of 8KB â It is a flash memory that supports in â system
programming.
3. Internal RAM of 256 bytes â The first 128 Bytes of the RAM i.e. 00H to 7FH is again
divided in to 4 banks with 8 registers (R0 â R7) in each bank, 16 bit addressable
registers and 80 general purpose registers.
4. The higher 128 Bytes of the RAM i.e. 80H to FFH consists of Special Function
Registers (SFR) which are used to control different peripherals such as Timers, Serial
Port, all I/O Ports, etc.
5. 32 I/O Pins â Arranged as 4 Ports: P0, P1, P2 and P3
6. 8-bit Stack Pointer (SP) and Processor Status Word (PSW)
7. 16-bit Program Counter (PC) and Data Pointer (DPTR)
8. Two 16-bit timers â T0 and T1
9. Interrupts â Two external and three internal
10. Oscillator and clock circuit
11. Serial Data Transmitter and Receiver for Full-Duplex operation â SBUF
12. Control Registers â SCON, PCON, TCON, TMOD, IP and IE
37. PORT
1. Term "port" refers to a group of pins on a microcontroller
which can be accessed simultaneously, or on which we can
set the desired combination of zeros and ones, or read from
them an existing status.
2. Physically, port is a register inside a microcontroller which is
connected by wires to the pins of a microcontroller. Ports
represent physical connection of Central Processing Unit with
an outside world.
3. Microcontroller uses them in order to monitor or control
other components or devices.
4. Due to functionality, some pins have twofold roles.
5. All port pins can be designated as input or output, according
to the needs of a device that's being developed.
38. IMPORTANT PINS (IO PORTS)
⢠One of the most useful features = 4 I/O ports (P0 - P3)
ďą Port 0 :-P0 = (P0.0 - P0.7)
ďą8-bit R/W - General Purpose I/O
ďąlow byte address and data bus for external
memory
ďą Port 1 :- P1= (P1.0 - P1.7)
ďąOnly 8-bit R/W - General Purpose I/O
ďą Port 2 :- P2 = (P2.0 - P2.7)
ďą8-bit R/W - General Purpose I/O
ďąhigh byte address for external memory
ďą Port 3:- P3 = (P3.0 - P3.7)
ďąGeneral Purpose I/O
ďąTimers(T0,T1) â ext. int (INT0, INT1) â Serial
(TXD, RXD)- RD,WR
Each port can be used as input or output (bi-direction)
40. IMPORTANT PINS
⢠Pins 1 to 8 â These pins are known as Port 1. This port doesnât serve any other functions. It is
internally pulled up, bi-directional I/O port.
⢠Pin 9 â It is a RESET pin, which is used to reset the microcontroller to its initial values.
⢠Pins 10 to 17 â These pins are known as Port 3. This port serves some functions like interrupts, timer
input, control signals, serial communication signals RxD and TxD, etc.
⢠Pins 18 & 19 â These pins are used for interfacing an external crystal to get the system clock.
⢠Pin 20 â This pin provides the power supply to the circuit.
⢠Pins 21 to 28 â These pins are known as Port 2. It serves as I/O port. Higher order address bus signals
are also multiplexed using this port.
⢠Pin 29 â This is PSEN pin which stands for Program Store Enable. It is used to read a signal from the
external program memory.
⢠Pin 30 â This is EA pin which stands for External Access input. It is used to enable/disable the external
memory interfacing.
⢠Pin 31 â This is ALE pin which stands for Address Latch Enable. It is used to demultiplex the address-
data signal of port.
⢠Pins 32 to 39 â These pins are known as Port 0. It serves as I/O port. Lower order address and data
bus signals are multiplexed using this port.
⢠Pin 40 â This pin is used to provide power supply to the circuit.
41. OSCILLATOR CIRCUIT
⢠Oscillator circuit is used for providing a
microcontroller with a clock. Clock is needed
so that microcontroller could execute a
program or program instructions.
Machine cycle
⢠8051 Clock and Instruction Cycle In 8051, one instruction
cycle consists of twelve (12) clock cycles. Instruction cycle
is sometimes called as Machine cycle by some authors.
42. â˘Instruction cycle of 8051
â˘In 8051, each instruction cycle has six states (S 1 - S 6 ).
â˘Each state has two pulses (P1 and P2)