0% found this document useful (0 votes)
29 views8 pages

Mes Unit1

The document provides an introduction to the 8051 microcontroller, detailing its features, block diagram, and various registers including the PSW and TCON. It explains the functions of specific pins, modes of operation such as Idle and Power Down, and the roles of the Accumulator and other registers. Additionally, it compares microprocessors and microcontrollers, highlighting key differences.

Uploaded by

shreyatemp2702
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views8 pages

Mes Unit1

The document provides an introduction to the 8051 microcontroller, detailing its features, block diagram, and various registers including the PSW and TCON. It explains the functions of specific pins, modes of operation such as Idle and Power Down, and the roles of the Accumulator and other registers. Additionally, it compares microprocessors and microcontrollers, highlighting key differences.

Uploaded by

shreyatemp2702
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Unit 1-Introduction to 8051 Microcontroller

Q.1.Compare between microprocessor and microcontroller (any four points).


Q.2. Draw block diagram of microcontroller.
Block Diagram of Microcontroller:

Q.3. State four features of 8051 microcontroller.

Features of 8051 micro controller are as follows:-


1) 8- bit data bus and 8- bit ALU.
2) 16- bit address bus – can access maximum 64KB of RAM and ROM.
3) On- chip RAM -128 bytes (Data Memoryǁ)
4) On- chip ROM – 4 KB (Program Memoryǁ)
5) Four 8-bit bi- directional input/output ports Four 8-bit bi- directional input/ output ports.
6) Programmable serial ports i.e. One UART (serial port)
7) Two 16- bit timers- Timer 0& Timer 1
8) Works on crystal frequency of 11.0592 MHz / 12 MHz
9) Has power saving and idle mode in microcontroller when no operation is performed.
10) Six interrupts are available: Reset, Two interrupts Timers i.e. Timer 0 and Timer 1, two
external hardware interrupts- INT0 and INT1, Serial communication interrupt for both receive
and transmit
Q.4 Draw the format of PSW register of 8051 microcontroller and describe it.
CY: the carry flag. 1. This flag is set whenever there is a carry out from the D7 bit. 2. The flag
bit is affected after an 8 bit addition or subtraction. 3. It can also be set to 1 or 0 directly by an
instruction such as ―SETB C and CLR C where SETB C stands for - set bit carry and CLR C
for - clear carry. AC: the auxiliary carry flag • If there is a carry from D3 and D4 during an
ADD or SUB operation, this bit is set; it is cleared. This flag is used by instructions that perform
BCD (binary coded decimal) arithmetic. 1. F0: Available to the user for general purposes.
2. RS0, RS1: register bank selects bits 1. These two bits are used to select one of the four
register banks from internal RAM as given in the table. 2. By writing zeroes and ones to these
bits, a group of registers R0- R7 can be used out of four registers banks in Internal RAM.

3. OV: the overflow flag This flag is set whenever the result of a signed number operation is
too large, causing the high-order bit to overflow into the sign bit. In general, the carry flag is
used to detect errors in unsigned arithmetic operations. The overflow flag is only used to detect
errors in signed arithmetic operations.
4. P: Parity flag: The parity flag reflects the number of 1s in the A (accumulator) register only.
If the A register contains an odd number of 1’s, then P=1, P=0 if A has an even number of 1’
Q.5. Draw the format of TCON SFR and explain each bit.
Timer Control or TCON Register in 8051 Microcontroller is used to start or stop the Timers.
It also contains bits to indicate if the Timers has overflowed. The TCON SFR also consists of
Interrupt related bits.
The following table gives the explanation of each bit in the TCON Register in 8051.
Q.6. Describe the function of following pins of 8051 microcontroller. (i)PSEN (ii)EA
(iii)ALE (iv)RESET
(i)PSEN 1.PSEN (program store enable). PSEN is the read strobe for external Program
Memory. In an 8031-based system in which an external ROM holds the program code, this pin
is connected to the OE pin of the ROM. PSEN is not activated for internal fetches.
(ii)EA 1. EA (external access).EA is pin number 31 in the DIP packages. It is an input pin and
must be connected to either Vcc or GND. It cannot be left unconnected. 2. The lowest 4K bytes
of Program Memory can be either in the on-chip ROM or in an external ROM. This selection
is made by connecting EA pin. 1. If the pin is connected to Vcc, then addresses 0000H through
0FFFH are directed to the internal ROM and addresses 1000H through FFFFH are directed to
external ROM. 2. If the pin is connected to Vss, then all address are directed to external ROM.
(iii)ALE ALE (Address latch enable). It is an output pin and is active high for latching the low
byte of address during accesses to external memory. The ALE pin is used for de-multiplexing
the address and data by connecting to the STB pin of the 74LS373 chip.
(iv)RESET Pin 9 is the Reset Input Pin. This is used for resetting the microcontroller to its
initial values. If the pin is set at logic 0, the chip runs normally. When the oscillator is running,
setting the pin at logic 1 for more than two machine cycles will reset the microcontroller.
Q.7. Draw the format of PCON register and explain function of each bit.
IDLE MODE

In the Idle mode, the internal clock signal is gated off to the CPU, but not to the Interrupt, Timer, and
Serial Port functions.
The CPU status is preserved in its entirety, the Stack Pointer, Program Counter, Program Status Word,
Accumulator, and all other registers maintain their data during Idle. The port pins hold the logical state
they had at the time idle mode was activated. ALE and PSEN hold at logic high levels.
There are two ways to terminate the idle mode.
i) Activation of any enabled interrupt will cause PCON.O to be cleared and idle mode is terminated.
ii) Hard ware reset: that is signal at RST pin clears IDEAL bit IN PCON register directly. At this time,
CPU resumes the program execution from where it left off.
POWER DOWN MODE

An instruction that sets PCON.1 causes that to be the last instruction executed before going into the
Power Down mode. In the Power Down mode, the on-chip oscillator is stopped. With the clock frozen,
all functions are stopped, but the on-chip RAM and Special Function Register are maintained held. The
port pins output the values held by their respective SFRS. ALE and PSEN are held low.
Termination from power down mode: an exit from this mode is hardware reset.
Reset defines all SFRs but doesn’t change on chip RAM.

Q.8 Draw the pin diagram of 8051 µc.


Q.9. Explain 8051 Microcontroller CPU or Math Registers:

A or Accumulator (ACC)
The Accumulator or Register A is the most important and most used 8051 Microcontroller SFRs. The
Register A is located at the address E0H in the SFR memory space. The Accumulator is used to hold
the data for almost all the ALU Operations.

Some of the operations where the Accumulator is used are:

•Arithmetic Operations like Addition, Subtraction, Multiplication etc.


•Logical Operations like AND, OR, NOT etc.
•Data Transfer Operations (between 8051 and External Memory)

The name “Accumulator” came from the fact this register is used to accumulate (or store) the result of
all Arithmetic and most of the Logical Operations.

B (Register B)

The B Register is used along with the ACC in Multiplication and Division operations. These
two operations are performed on data that are stored only in Registers A and B. During
Multiplication Operation, one of the operand (multiplier or multiplicand) is stores in B
Register and also the higher byte of the result.

In case of Division Operation, the B Register holds the divisor and also the remainder of the
result. It can also be used as a General Purpose Register for normal operations and is often
used as an Auxiliary Register by Programmers to store temporary results.Register B is
located at the address F0H of the SFR Address Space.

Pointer Registers
Data Pointer (DPTR – DPL and DPH)
The Data Pointer is a 16-bit Register and is physically the combination of DPL (Data Pointer
Low) and DPH (Data Pointer High) SFRs. The Data Pointer can be used as a single 16-bit
register (as DPTR) or two 8-bit registers (as DPL and DPH).

DPTR doesn’t have a physical Memory Address but the DPL (Lower Byte of DPTR) and
DPH (Higher Byte of DPTR) have separate addresses in the SFR Memory Space. DPL = 82H
and DPH = 83H.

The DPTR Register is used by the programmer addressing external memory (Program –
ROM or Data – RAM).

Stack Pointer (SP)


SP or Stack Pointer points out to the top of the Stack and it indicates the next data to be
accessed. Stack Pointer can be accesses using PUSH, POP, CALL and RET Instructions. The
Stack Pointer is an 8-bit register and upon reset, the Stack Pointer is initialized with 07H.

When writing a new data byte into the stack, the SP (Stack Pointer) is automatically
incremented by 1 and the new data is written at an address SP+1. When reading data from
stack, the data is retrieved from the Address in SP and after that the SP is decremented by 1
(SP-1).

You might also like