Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

UNIT-I 8051 ARCHITECTURE

Q.1) Differentiate between a microcontroller and a microprocessor? (5m)

Nov/Dec 2018

Difference between microprocessor and microcontroller

Microprocessor Microcontroller
1. Microprocessor is used to perform many 1. It is used to perform single task (specific
task (general purpose) purpose).
2. It does not contain on chip RAM/ROM ,I/O 2. It has fixed amount of RAM/ROM , I/O
ports timers etc. ports ,timers / counters on chip
3. It requires more external hard ware 3. It requires less external hardware
4. The systems designed using 4. The systems designed using
microprocessor are bulky and consumes microcontroller are compact and
more power. consumes less power.
5. Versatile and general purpose. 5. Not very versatile
6. Large number of instructions with flexible 6. Limited number of instructions with few
addressing modes. addressing modes .
7. Very few instructions with bit-handling 7. Limited number of instructions with bit-
capability handling capability
8. It is used in general purpose like network 8. It is used for embedded systems like TV
server, internet terminal bank teller remote control, keyboard, mouse,
machine. Examples for microprocessors microwave oven etc. Examples for
are:80286,80386 Pentium microcontrollers are 8031, 8051, 8052,
etc.

Q.2) Compare the features of RISC & CISC. (5m)

Nov/Dec 2017, Apr/May 2018,

Comparison between Features of RISC and CISC Processors

RISC CISC
1. Few instructions. 1. Many instructions.
2. Few addressing modes. 2. Larger addressing modes.
3. Fixed length instruction formats. 3. Variable length instruction formats.
4. Reduced complexity in hardware 4. Complex hardware
5. Instructions are executed in small clock 5. Execution time for an instruction may
periods. Hence they are faster than CISC take several clock cycles.
6. Examples for RISC are ARM processors. 6. Example for CISC are Intel
80286,80386,Pentium processors.
Q.3) Write a note on selection criteria of microntrollers.(5m)

The following points must be noted in selecting a microcontroller:

1) Whether the microntroller is efficient & economical to perform the task at hand.
To check this condition the following parameters are considered,
i) Maximum operating speed
ii) Type of package i.e., DIP(Dual in Line) or QEP(Quad Flat Pack).
iii) Power consumption.
iv) The amount of on chip RAM and ROM.
v) The number of timers and I/O ports available.

2) Availability of product development tools (like assembler,compilers,simulators ,debugger) from


manufacturers and third party vendors.
3) Availability of chip at present and in future.

Q.4) List the architectural features of 8051 microcontroller.(5m)

NOV/DEC 2017, OCT/NOV 2019

Features of 8051 microntrollers are:

1) 4K bytes of chip ROM.


2) 128 bytes of on chip RAM.
3) Two Timers.
4) One serial port.
5) Four I/O Ports (32 I/O pins).
6) Six interrupt resources.

Q.5) Define Microntroller .List any five applications of microcontrollers.(5m)

APR/MAY 2018, APR/MAY 2019, OCT/NOV 2019

Microcontroller: It is an embedded system used for specific task. Microcontroller has CPU in addition to
the fixed amount of RAM ROM I/O PORTS,Timers Serial port embedded(integrated) on a single chip. It is
also known as system on chip.
Some specific applications of microntrollers are:

1) Home appliances: TV remote controllers, Telephones, Sewing machines,Washing machines,


Micro oven etc.
2) Automobiles: car security alarm, Trip meater,Transmission control etc.
3) Entertainment: Toys, PDAs(Personal Digital Assistants) etc.
4) Instrumentation: Storage oscilloscopes, Signal generators, Printers, Keyboard, Mouse etc.
5) Consumer items: cellular phones, air conditioners, refrigerators etc.

Q.6) Explain the architecture of 8051 microcontroller.(10m)

APR/MAY 2017, APR/MAY 2019, OCT/NOV 201

OR
Specific features of 8051 are:

1) 8-bit CPU with two registers (A) Accumulator & Register B. Accumulator is used in most of ALU
operations. Register B used for integer multiplication and division.
2) A 16-bit register called Program Counter (PC).It holds the address of the location of the next
instruction to be executed.
3) A16-bit Data Pointer (DPTR) register. It is used to access external memory.
4) An 8-bit Program Status Word(PSW) register . it indicates certain conditions like status of carry,
parity ,sign etc. after execution of some instruction.
5) Internal RAM of 128 bytes divided as:-
 Four register banks of 8 registers each.
 16 bytes, which are bit addressable.
 80 bytes of general RAM.
6) Internal ROM used to store program code.
7) Four 8-bit ports ,P0 to P3. A port pin is a pin ,where data can be transmitted to or read from an
external device.
8) Two 16-bit timers, T0 and T1 can be used as timer or counter.
9) Full duplex serial port is used for serial communication.
10) Two external and 3 internal interrupts are used to stop normal execution of instructins.
11) Oscillator and clck circuits

Q.7) Explain the functions of the following pins (5m)

(1) ALE (2) PSEN (3)T0 (4) INT1 (5) TxD NOV/DEC 2017

1) ALE – Address Latch Enable pin

ALE pin is used to indicate whether P0 pins carries address or data.when it is high P0 pins
carries lower order address(A0 –A7) and when it is low P0 pins carries data(D0-D7) .

2) PSEN – Program Strobe Enable pin

It is use as read strobe to external program memory( ROM). In 8031 this pin is
connected to OE pin of external ROM chip. To acess the program code EA pin is grounded and PSEN will
go low to enable external ROM chip.

3) T0 - timer 0 external input

4) INT1 - External interrupt pin

5) Txd - (serial transmit output pin) transmits data during serial communication via serial port.
FUNCTIONS OF 8051 PINS

VCC- Pin 40 provides voltage to the chip. The supply voltage is +5V.

GND – Pin 20 is the ground.

XTAL1 & XTAL2 –(Pin 18 & 19) 8051 has an on chip oscillator but requires an external clock source
to run it. Most commonly quartz crystal is connected to crystal inputs.

PORT 0 (P0) – pins 32 to 39

It is used for dual purpose i.e., when no external memory is present, it is used as general
purpose I/O port. PORT0 has eight I/O pins P0.0 to P0.7. To use P0 as input/output port each pin must
be connected externally to 10K ohm pull-up resistor. Upon reset the P0 is configured as output port. To
make P0 as input, the P0 must be programmed by writing 1 to all its bits.

But if external memory is connected to 8051 then PORT0 provides both address and data
lines(AD0 – AD7). 8051 multiplexes address and data through P0 to save pins.

PORT 1 (P1) – Pins 1 to 8

PORT1 is used as general purpose I/O port with internal pull ups. PORT1 has
eight I/O pins P1.0 to P1.7. Upon reset the P1 is configured as output port. To make P1 as input, the P1
must be programmed by writing 1 to all its bits.

PORT2 (P2) - Pins 21 to 28

PORT2 is used as general purpose I/O port with internal pull ups. PORT2 has
eight I/O pins P2.0 to P2.7. Upon reset the P2 is configured as output port. To make P2 as input, the P2
must be programmed by writing 1 to all its bits.

If external memory access is required then P2 acts as an address bus in


conjunction with PORT0. This PORT provides A8-A15 address lines.

PORT3 (P3) - Pins 10 to 17

PORT 3 (P3) acts as a I/O port and has 8 pins P3.0 to P3.7.

It has additional functions as explained below,

Rxd- (serial receive input pin) Receives data during serial communication via serial port.

Txd - (serial transmit output pin) transmits data during serial communication via serial port
INT0 – External interrupt 0 pin

INT1 - External interrupt 1 pin

T0 - timer 0 external input

T1 - timer 1 external input

WR – external data memory write strobe

RD – external data memory read strobe

RST – Reset pin

Pin 9 is the reset input. Upon applying high pulse on this pin microcontroller will
reset and terminates all activities.

ALE – Address Latch Enable pin

ALE pin is used to indicate whether P0 pins carries address or data.when it is high P0 pins
carries lower order address(A0 –A7) and when it is low P0 pins carries data(D0-D7) .

PSEN – Program Strobe Enable pin

It is use as read strobe to external program memory( ROM). In 8031 this pin is
connected to OE pin of external ROM chip. To acess the program code EA pin is grounded and PSEN will
go low to enable external ROM chip.

ĒĀ – External access enable.

EA pin must be connected to GND to enable the device to fetch code from
external program memory locations starting at 0000h to FFFFh.

This pin must be connected to +VCC for internal program executions.This pin
also receives 12 V Programming Enable Voltage (VPP) during flash programming.

Q.8) Sketch the structure of PSW and write the functions of various flags.(5M) NOV/DEC 2017

OR Explain the significance of PSW of 8051. (5m) APR/MAY 2019

OR Explain PSW reg of 8051 microcontroller. (5m) OCT/NOV 2019


Functions of each bit of PSW are:

Carry flag(CY): PSW.7 or D7

This flag is used to indicate carry/borrow generated during arithmetic operations


like addition,substraction etc.

Auxiliary carry flag(AC) : PSW.6 or D6

It is set when there is carry from D3 to D4 bit position i.e, from lower nibble to
higher nibble . It is not accessable to user by any instruction.

Overflow flag(OV): PSW.2 or D2

It is used during signed arithmetic. It is set when there is carry from D6 to D7 and
not out of D7 or there is a carry from D7 out but no carry from D6 to D7 bit. It indicates the results of the
operation on signed numbers are too large for the register.

Parity flag(P): PSW.0 or D0

This flag indicates whether Reg A contains odd number of 1’s or even number of 1’s

It is set for odd parity number(odd number of 1’s in accumulator) and reset for even parity number(even
number of 1’s in accumulator).

Ex; if Reg A= 1001 0111 =97H then P=1

Register bank select bits(RS0 & RS1): PSW.3 or D3 and PSW.4 or D

These two bits PSW are used to select register bank.By default on power u bank 0 is
selected. To change register bank RS0 &RS1 are used as follows:

RS1 RS0 Register Bank Address


0 0 Bank 0 00h-07h
0 1 Bank 1 08h-0Fh
1 0 Bank 2 10h-17h
1 1 Bank 3 18h-1Fh
F0 and F1(PSW.5 &PSW.1): These are general purpose user defined flags.

Q.9)Explain the functions of Reg A ,Reg B, PC, SP & DPTR.(5m)


NOV/DEC 2018

Reg A: It is an 8 bit register, all arithmetic and logical operations are done using this. It is a bit
addressable register.

Reg B: It is an 8 bit register used in multiply and division operations and as generalpurpose reg to
store data temporarily. It is also a bit addressable register.

Program Counter (PC): Program Counter is a 16 bit register that holds address of the next instruction
to be executed. PC does not have internal address. It is reset to 0000h upon power up. The contents of
PC is altered by certain interrupt related instructions or branching instructions.

Stack Pointer(SP): Stack is a part of RAM used by CPU to store information temporarily. To use stack
memory a register called Stack Pointer (SP) is used. By default Reg SP points to memory location 07h.
The Stack Pointer is incremented or decremented automatically with PUSH and POP instructions.

DPTR (Data Pointer Reg): Data Pointer is a 16 bit register used to access external memory. It can also
be used as two 8 bit registers as DPH and DPL. The address of DPL is 82h and DPH is 83h.

Q.10)Explain Memory Organization of 8051 with neat sketch.(10m)

8051 Microcontroller has 128 bytes ofinternal RAM reffered by an address from 00h
to 7Fh. This RAM is divided into three different groups as :

1) Register Banks
2) Bit addressable RAM
3) Scratch pad RAM

1) Register Banks(00h – 1Fh)


Total 32 locations are used for register banks. They are Bank 0, Bank
1, Bank 2 and Bank 3. Each bank consists of 8 registers R0 – R7. By defaulton power up Bank 0 is
selected. Selection of Reg Bank is done by setting the bits RS0 &RS1 of PSW Reg.

RS1 RS0 Register Bank Address

0 0 Bank 0 00h-07h

0 1 Bank 1 08h-0Fh

1 0 Bank 2 10h-17h

1 1 Bank 3 18h-1Fh

After selecting a Reg bank , particular Reg can be accessed by its name (R0 – R7) or by its
address(00h – 07h).
2) Bit Addressable RAM(16 bytes or 128 bits, 20h – 2Fh)
The RAM locations 20h to 2Fh of RAM are used for bit
addressable . This means each of their bits can be addressed individually . Each bit has a unique
address from 00h – 7Fh (total 128 bits)

Example: 17h is the bit address of the bit7 in byte address 22h
30h is the bit address of the bit0 in byte address 26h
69h is the bit address of the bit1 in byte address 2Ch
Addressable bits are very useful in control of binary events(like switching ON/OFF a switch)
The instrucions specify whether to access the byte or bit address.

3) General Purpose RAM(80 bytes ,30h _ 7Fh)


The RAM area with address 30h to 7Fh is use as
general purpose RAM or scratch pad RAM for storing data .

You might also like