Unit 1
Unit 1
Unit 1
Embedded systems are used for real time applications with high reliability
accuracy and precision. Embedded systems are operated with real time operating
systems (RTOS).
MICROPROCESSOR
PWM
TIMER
MICROCONTROLLER
ETHERNET
I/O PORTS
USB
DMA CONTROLLER
MEMORY
MICROPROCESSOR MICROCONTOLLER
1. Contains ALU, GP registers, SP, PC ,clock 1. In addition , it contains inbuilt ROM, RAM, I/O
Timing circuits and interrupts Devices, timer/counters.
2. Many instructions are required to move 2. One or more instructions are required to move
Data between memory and CPU Data between memory and CPU
3. One or two bit handling instructions are 3. More number of bit handling instructions are
Available Available
4. Access time for memory and I/O devices 4. Access time for memory and I/O devices
Are more. Are less.
5. require more hardware, increase in PCB 5. require less hardware, reduce in PCB
Size Size
6. few pins are multifunctional 6. more pins are multifunctional
7. microprocessor based computers are normally 7. microcontroller based systems are normally
Operated with general purpose operating systems Operated with real time operating systems
-------------------------------------------------------------------------------------------------------------------
ADC @ PKL DEPARTMENT OF ELECTRONICS
INTERNAL INTERRUPT
4 KB 128 BYTES OF
TIMER 1
INTERRUPT
ROM RAM TIMER 0
CONTROL
CPU
P0 P1 P2 P3 TxD RxD
POWER:
8051 operates with single power supply voltage of +5 volts, which is applied
through pin 40. The circuit ground is at pin 20 of the microcontroller chip.
PORTS :
Ports are essential to connect a microcontroller to the outside world. The
primary function of a microcontroller is to accept data from input devices such as
keyboards and A/D converters, read instructions from memory, process data according
to the instructions and send the result to output devices. This input and output devices
are called either peripherals or I/O devices.
8051 I/O ports structure is extremely versatile. It has four parallel
ports via p0, p1, p2 and p3 each port of 8 bits. These constitute (8x4) 32 I/O lines and all
ports are bi-directional. Each pin may be serving as input, output or both under software
control.
Port 0: port 0 is an 8 bit port with 8 I/O lines. Port 0 pin serve as
PORT 1 :
Port 1 occupies a total of 8 pins. It can be used as input or output. In contrast to
port 0, this port does not need any pull-up resistors since it already has pull-up resistors
internally. Upon reset, port 1 is configured as an input port
----------------------------------------------------------------------------------------------------------------------
ADC @ PKL DEPARTMENT OF ELECTRONICS
Port 2: port 2 is an 8 bit port with 8 I/O lines. Port 2 pin serve as
Input or output pins(I/O)
Address bus
Port 2 can be used as I/O port, when address bus is not required to
access external memory. External pull-up resistors are required for port2 during I/O
mode, internal pull-up resistors are off. When the port 2 pins are assigned as address
bus the output pins are connected through internal pull-up resistors
Note: I/O mode (pull-up resistors), Address bus (no pull-up resistors)
Port 3 :
Port 3 is used for dual functions as
I/O port
Alternate I/O functions
Port 3 occupies total of 8 pins, it can be used as input or output.p3 does
not need any pull-up resistors, port 3 has the additional function of providing some
extremely important signals such as interrupts. Port 3 can be used for alternate
functions, in which few are input and few are output. The functions of each port pin as
an alternate function is indicated below
CLOCK: The 8051 has an on-chip oscillator but requires an external clock to run it. A
quartz crustal oscillator is connected to inputs XTAL1 and XTAL2.
Oscillator (clock) is the driving force, which synchronizes the internal
operations of the microcontroller. 8051 contains in built clock circuit that contains an on
chip inverter to control crystal, when a crystal is used at frequency above 10 MHz c1 and
c2 should be in the range of 10pf to 12pf. Oscillator formed by the crystal, capacitors
and inverter generates a pulse train at the frequency of the crystal.
Machine cycle: it is defined as the minimum amount of time taken to execute a simple
instruction of the microcontroller. A single machine cycle consists of 12 pulses.
RESET :
To reset the microcontroller the RST pin should be held high for at least 2
machine cycles (24 oscillator periods). When the system is reset all the SFR’S are
initialized to 00H except the stack pointer. The reset circuit for 8051 is shown below. R
and C values should be adjusted such that, the RST pin is high for at least 24 clock
periods.
VCC
10MF
8.2 K
--------------------------------------------------------------------------------------------------------------------