You are on page 1of 19

Designing embedded systems with 8-bit

microcontrollers-8051
• Factors to be considered choosing a controller
 Feature set
 Speed of operation
 Code memory space
 Data memory space
 Development support
 Availability
 Power consumption
 Cost
Address Lines

Data Lines Memor


µp/mc
y
Control
Lines

Interface
3
4
Demultiplexing
Address/Data Lines
Data

74LS37 Memor
808 AD0- 3 A0 – y
5 AD7 ALE A7
Contro
Chip
l

A8- A8-
A15 A15
Memory
Interface
5
Paged data memory
• In paged mode addressing: memory arranged
like lines of a notebook. Notebook may
contain 100-200 pages and each page may
contain fixed no. of lines
• Access specific line by knowing its page no.
• Each page consist 256 line i.e 256 byte(00-FF)
• Each page is identified by P2.0(1-bit) 0/1
• Each line identified by P0(8 bit)
The von-neumann memory
model for 8051
Lower & Upper128 byte internal data memory organization
(RAM)
Upper 128 bytes of scratchpad RAM
• Variants of 8051 and the 8052 architecture where
upper 128 bytes of RAM are physically
implemented in the chip can be used as general
purpose scratchpad by indirecting addressing,
known as IRAM.
• Address range from 80-FF and access is indirect
• R0 and R1 are pointers
• Ex: MOV R0,#80
• MOV A,@R0
Registers
• Accumulator –A
• B-register
• PSW
• DPTR
• Program Counter-PC
• Stack Pointer- SP
Oscillator Circuit
• An oscillator is a device that can give you a clock at a certain frequency
given a constant voltage.
• Most microcontrollers only require a crystal because they contain all other
parts of an oscillator already.
• There are some important advantages of crystal oscillator are given below,
The crystal oscillators have very high frequency stability.
• The crystal oscillator is possible to obtain very high precise and stable
frequency of oscillators. It has High frequency of operation
• Execution speed:
 Directly proportional to the oscillator clock frequency.
 Increasing clock impact on speed of program execution.
Machine Cycles
• The 8051 operates based on an external crystal. ... Effectively,
the 8051 operates using what are called "machine cycles." A
single machine cycle is the minimum amount of time in which
a single 8051 instruction can be executed. although many
instructions take multiple cycles.
• Fetch - Retrieve an instruction from the memory.
• Decode - Translate the retrieved instruction into a series of
computer commands.
• Execute - Execute the computer commands.
• Store - Send and write the results back in memory.
Port 0
• Port-0 can be used as a normal bidirectional I/O port or it can be used for
address/data interfacing for accessing external memory. When control is
‘1’, the port is used for address/data interfacing. When the control is ‘0’,
the port can be used as a bidirectional I/O port.
• PORT 0 as an Input Port
• Let us assume that control is ‘0’. When the port is used as an input port,
‘1’ is written to the latch.
• In this situation both the output MOSFETs are ‘off’. Hence the output pin
have floats hence whatever data written on pin is directly read by read pin
• PORT 0 as an Output Port
• Suppose we want to write 1 on pin of Port 0, a ‘1’ written to the latch
which turns ‘off’ the lower FET while due to ‘0’ control signal upper FET
also turns off as shown in fig. above.
• Here we wants logic ‘1’ on pin but we getting floating value so to convert
that floating value into logic ‘1’ we need to connect the pull up resistor
parallel to upper FET . This is the reason why we needed to connect pull
up resistor to port 0 when we want to initialize port 0 as an output port .
• If we want to write ‘0’ on pin of port 0 , when ‘0’ is written to the latch, the pin is pulled
down by the lower FET. Hence the output becomes zero.
• PORT 0 as an address/data Port

• When the control is ‘1’, address/data bus controls the output


driver FETs.
• If the address/data bus (internal) is ‘0’, the upper FET is ‘off’
and the lower FET is ‘on’. The output becomes ‘0’.
• If the address/data bus is ‘1’, the upper FET is ‘on’ and the
lower FET is ‘off’. Hence the output is ‘1’.
• Hence for normal address/data interfacing (for external
memory access) no pull-up resistors are required.
• Port-0 latch is written to with 1’s when used for external
memory access.
Assignment
• Port- 1
• Port- 2
• Port- 3
• Source and sink current for 8051 ports

You might also like