Test Material
Test Material
Microcontroller:
A microcontroller is a highly integrated single chip, which consists of on chip CPU
(Central Processing Unit), RAM (Random Access Memory), EPROM/PROM/ROM (Erasable
Programmable Read Only Memory), I/O (input/output) – serial and parallel, timers, interrupt
controller.
❖ For example, Intel 8051 is 8-bit microcontroller and Intel 8096 is 16-bit microcontroller.
Microcontroller Consist Of;
1. ALU
2. A-Accumulator
3. B-Register
4. PC-Program Counter
5. PSW Register
6. Stack Pointer
7. DPTR (Data Pointer)
8. Timers\ Counters
9. Input Output Ports
10. Memory organization
11. Internal RAM
12. On chip ROM
13. SFR’S Special Function Registers
14. Oscillator
CY AC F0 RS1 RS0 OV _ P
The bits PSW3 and PSW4 are denoted as RS0 and RS1 and these bits are used to select
the bank registers of the RAM location.
P (Parity flag) → PSW 0.0
1 – odd number of 1 in ACC
0 – even number of 1 in ACC
Stack Pointer:
In 8051 RAM locations from 08H to 1FH can be used as stack. Stack is used to store the
data temporarily.
Stack is last in first out (LIFO).Stack pointer (SP) is a 8bit register.
It indicates current RAM address available for stack or it points the top of stack.
Initially by default at 07H because first location of stack is 08H.
After each PUSH instruction the SP is incremented by one while in MC after PUSH
instruction SP is decremented.
After each POP instruction the SP is decremented.
DPTR (Data Pointer):
This is a 16 bit register which is used to furnish address information for internal
and external program memory and for external data memory.
It is divided into two parts DPH and DPL .
DPH for Higher order 8 bits, DPL for lower order.
Timers\ Counters:
The 8051 has two counters/timers which can be used either as timer to generate a time
delay or as counter to count events happening outside the microcontroller.
The 8051 has two timers: timer0 and timer1. They can be used either as timers or as
counters. Both timers are 16 bits wide. Since the 8051 has an 8-bit architecture, each 16-
bit is accessed as two separate registers of low byte and high byte.
Serial Port:
There are two pins available for serial communication TXD and RXD o Normally TXD
is used for transmitting serial data which is in SBUF register, RXD is used for receiving
the serial data.
SCON register is used for controlling the operation.
Memory organization:
The 8051 microcontroller has 128 bytes of Internal RAM and 4kB of on chip ROM.
The RAM is also known as Data memory and the ROM is known as program memory.
The program memory is also known as Code memory.
This Code memory holds the actual 8051 program that is to be executed.
In 8051 this memory is limited to 64K. o Code memory may be found on-chip, as ROM
or EPROM. It may also be stored completely off-chip in an external ROM or, more
commonly, an external EPROM.
The 8051 has only 128 bytes of Internal RAM but it supports 64kB of external RAM. As
the name suggests, external RAM is any random access memory which is off-chip.
Since the memory is off-chip it is not as flexible interms of accessing, and is also slower.
For example, to increment an Internal RAM location by 1, it requires only 1 instruction
and 1 instruction cycle but to increment a 1-byte value stored in External RAM requires 4
instructions and 7 instruction cycles. So, here the external memory is 7 times slower.
On chip ROM:
In 8051, 4KB read only memory (ROM) is available for program storage.
This is used for permanent data storage. Or the data which is not changed during the
processing like the program or algorithm for specific applications.
This is volatile memory; the data saved in this memory does not disappear after power
failure. We can interface up to 64KB ROM memory externally if the application is large.
Oscillator: It is used for providing the clock to MC8051 which decides the speed or baud rate of
MC. We use crystal which frequency varies from 4MHz to 30 MHz, normally we use 11.0592
MHz frequency.