Microcontroller Notes-1

You might also like

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

Q1.

Draw functional block diagram of 8085 for data and instruction used for transferring
microprocessor. transfer. data and instruction.
Two clock cycles are An instruction is
required to execute executed in a single
single instruction. cycle.
It is cheaper in cost. It is costly than Von
Neumann Architecture.
CPU can not access CPU can access
instructions and instructions and
read/write at the same read/write at the same
time. time.
It is used in personal It is used in micro
computers and small controllers and signal
computers. processing.

Q2. Name five functional units of 8085 Q5.What is Von Neumann Architecture?
microprocessor. It is a type of digital computer architecture in which
Ans. Accumulator It is an 8-bit register used to the design follows the concept of the computers with
perform arithmetic, logical, I/O & LOAD/STORE stored programs where they store the program data
operations. It is connected to internal data bus & ALU. along with the instruction data in the very same
Arithmetic and logic unit As the name suggests, it memory. The famous physicist and mathematician
performs arithmetic and logical operations like John Von Neumann designed this architecture back in
Addition, Subtraction, AND, OR, etc. on 8-bit data. 1945.
General purpose register There are 6 general purpose Q6.What is Harvard Architecture?
registers in 8085 processor, i.e. B, C, D, E, H & L. Each It is a type of digital computer architecture in which
register can hold 8-bit data. These registers can work the design follows a basic concept of having separate
in pair to hold 16-bit data and their pairing signal paths (buses) and separate storage for data and
combination is like B-C, D-E & H-L. instructions. This type of architecture basically
Stack pointer It is also a 16-bit register works like surfaced to overcome the overall bottleneck of the
stack, which is always incremented/decremented by 2 Von Neumann Architecture.
during push & pop operations. Q7 Write four important differences between
Temporary register It is an 8-bit register, which holds Microprocessor and Microcontroller.
the temporary data of arithmetic and logical
operations.
Flag register It is an 8-bit register having five 1-bit flip-
flops, which holds either 0 or 1 depending upon the
result stored in the accumulator.
Q3. What is the bit size of internal data bus in 8085
microprocessors
In the 8085 microprocessor, The Address bus is 16 bits
(A0-A15) and can transfer a maximum 16 bit address
and hence can address 65,536 different memory
locations. This bus is multiplexed with 8 bit data bus.
Q4. Write three difference between Von Neuman
and Harvard Architecture.
VON NEUMANN HARVARD
ARCHITECTURE ARCHITECTURE
It is ancient computer It is modern computer
architecture based on architecture based on
stored program Harvard Mark I relay
computer concept. based model.
Same physical memory Separate physical Q8.What is a Microprocessor?
address is used for memory address is A microprocessor is a controlling unit of a micro-
instructions and data. used for instructions computer wrapped inside a small chip. It performs
and data. Arithmetic Logical Unit (ALU) operations and
There is common bus Separate buses are communicates with the other devices connected with
it. It is a single Integrated Circuit in which several • Cameras
functions are combined. • Security alarms
Q9.What is Microcontroller? • Keyboard controllers
A microcontroller is a chip optimized to control • Microwave oven
electronic devices. It is stored in a single integrated • Watches
circuit which is dedicated to performing a particular • Mp3 players
task and execute one specific application. Q16. What is data pointer (DTPR) in 8051?
It is specially designed circuits for embedded The Data Pointer (DPTR) in 8051
applications and is widely used in automatically • The Data Pointer (DPTR) is the 8051s only
controlled electronic devices. It contains memory, user-accessible 16-bit (2-byte) register.
processor, and programmable I/O. • The Accumulator, “R” registers, and “B”
Q10.Types of Microprocessor register are all 1-byte values.
Important types of Microprocessors are: • DPTR, as the name suggests, is used to point
• Complex Instruction Set Microprocessors to data. It is used by a number of commands
• The Application Specific Integrated Circuit which allow the 8051 to access external
• Reduced Instruction Set Microprocessors memory.
• Digital Signal Multiprocessors (DSPs) • When the 8051 accesses external memory it
Q11. Types of Microcontroller will access external memory at the address
Here are important types of Microcontroller: indicated by DPTR.
• 8 bit Microcontroller • While DPTR is most often used to point to
• 16 bit Microcontroller data in external memory, many programmers
• 32 bit Microcontroller often take advantage of the fact that it is the
• Embedded Microcontroller only true 16-bit register available. It is often
• External memory Microcontroller used to store 2-byte values which have
Q 12. Features of Microprocessor nothing to do with memory locations.
Here are some important features of Microprocessor: Q17. The Stack Pointer (SP) in 8051
• Offers built-in monitor/debugger program • The stack is a section of internal RAM used by
with interrupt capability the CPU to store information temporarily. This
• Large amount of instructions each carrying information could be data or an address.
out a different variation of the same operation • The CPU needs this storage area since there
• Offers Parallel I/O are only limited number of registers. The
• Instruction cycle timer register to access the stack is called Stack
• External memory interface Pointer.
Q13. Features of Microcontroller • The stack pointer (SP) is an 8-bit register
Here are some important features of Microcontroller: within the SFR area, with the address 81H and
• Processor reset it can point an address location between 00h
• Program and Variable Memory (RAM) I/O pins to FFh.
• Device clocking central processor • Stack pointer is used to hold the address of
• Instruction cycle timers Top of the Stack. The address held in the SP is
Q14. Applications of Microprocessor the location in internal RAM where the last
Microprocessors are mainly used in devices like: byte of data was stored by a stack operation.
• Calculators • This register can hold one 8-bit address at a
• Accounting system time, which is actually the memory location at
• Games machine top of the stack.
• Complex industrial controllers • The stack pointer is initialized to the value 07H
• Traffic light when the 8051 microcontroller is reset.
• Control data Q18. The Program Counter (PC) in 8051
• Military applications • The Program Counter (PC) is a 2-byte address
• Defense systems which tells the 8051 where the next
• Computation systems instruction to execute is found in memory.
• When the 8051 is initialized PC always starts
Q15. Applications of Microcontroller at 0000h and is incremented each time an
Microcontrollers are mainly used in devices like: instruction is executed.
• Mobile phones • It is important to note that PC isn’t always
• Automobiles incremented by one. Since some instructions
• CD/DVD players require 2 or 3 bytes the PC will be
• Washing machines incremented by 2 or 3 in these cases.
• The Program Counter is special in that there is Register addressing mode - In the register addressing
no way to directly modify its value. That mode the source or destination data should be
means, you can’t do something like PC=2000h. present in a register (R0 to R7). These are some
On the other hand, if you execute instruction examples of RegisterAddressing Mode.
LJMP 2000h you have effectively MOVA, R5; MOVR2, #45H;
accomplished the same thing. Direct Addressing Mode- In the Direct Addressing
Q19. Explain Program Status Word (PSW) register of Mode, the source or destination address is specified
8051. by using 8-bit data in the instruction.
PSW Register in 8051 Microcontroller Program Status MOV80H, R6; MOVR2, 45H;
Word Register indirect addressing Mode- In this mode, the
• Flags are single bit register and used to store source or destination address is given in the register.
the result of certain function after executing By using register indirect addressing mode, the
instruction. Flags are grouped inside PSW and internal or external addresses can be accessed.
PCON registers. MOV0E5H, @R0; MOV@R1, 80H
• PSW register in 8051 microcontroller contains Indexed addressing mode In the indexed addressing
math flags and PCON contains general user mode, the source memory can only be accessed from
flags. program memory only.
• Math flags are grouped in PSW of MOVCA, @A+PC; MOVCA, @A+DPTR;
microcontroller 8051 and they are Carry(C), Implied Addressing Mode- In the implied addressing
Auxiliary Carry (AC), Over flow (OV), and mode, there will be a single operand. These types of
Parity (P). The general user flags are GF0 and instruction can work on specific registers only
GF1 which are grouped in PCON register. RLA; SWAPA;
PSW Register in 8051 Q. 22 Write an assembly language programme for
• The PSW is accessible fully as an 8-bit register, 8051 microcontrollerto add two 8 bit numbers stored
with the address D0H. in consecutive memory locations 30H and 31H. Store
• The bit pattern of this flag register is the 16 bit result in memory locations 35H (higher
order byte) and 36H(lower order byte).
ORG 00H ; Set the origin address
MOV DPTR, #30H ; Load the address of first number
(30H) into DPTR
MOVX A, @DPTR ; Move the content of address 30H
to accumulator A
Figure 1: Format of PSW register in 8051 INC DPTR ; Increment DPTR to point to the next
Microcontroller memory location (31H)
Q20.Define bit- addressable memory and write range MOVX B, @DPTR ; Move the content of address 31H
of address of bit addressable memory to accumulator B
AnsOf the 128-byte internal RAM of the 8051, only 16 ADD A, B ; Add the contents of A and B
bytes are bit-addressable. The rest must be accessed MOV R2, A ; Move the result to R2 (higher order byte)
in byte format. The bit-addressable RAM locations are MOV A, R2 ; Move the result from R2 back to
20H to 2FH. These 16 bytes provide 128 bits of RAM accumulator A
bit-addressability since 16×8= 128. They are addressed MOV @35H, A ; Store the higher order byte at address
as 0 to 127 (in decimal) or 00 to 7FH. Therefore, the 35H
bit addresses 0 to 7 are for the first byte of internal MOV A, #00H ; Clear accumulator A
RAM location 20H, and 8 to OFH are the bit addresses MOV A, B ; Move the content of B to accumulator A
of the second byte of RAM location 21H, and so on. MOV @36H, A ; Store the lower order byte at address
The last byte of 2FH has bit addresses of 78H to 7FH. 36H
See Figure 5-1 and Example 5-11. Note that internal Q.23 Write and assembly language programme for
RAM locations 20 – 2FH are both byte-addressable 8051 microcontroller to multiply two 8 bit numbers
and bit-addressable stored in consecutive memory locations 40H and
Q 21. Write name of different Addressing Modes of 41H. Store the 16 bit result in memory locations 45H
8051 microcontroller. (higher order byte) and 46H (lower order byte).
Immediate addressing mode- In this Immediate ORG 00H ; Set the origin address
Addressing Mode, the data is provided in the MOV DPTR, #40H ; Load the address of first number
instruction itself. The data is provided immediately (40H) into DPTR
after the opcode. These are some examples of MOVX A, @DPTR ; Move the content of address 40H
Immediate Addressing Mode. to accumulator A
MOVA, #0AFH; MOVR3, #45H;
INC DPTR ; Increment DPTR to point to the next
memory location (41H)
MOVX B, @DPTR ; Move the content of address 41H
to accumulator B
MUL AB ; Multiply the contents of A and B
MOV R2, A ; Move the result (higher order byte) to R2
MOV R3, B ; Move the carry (lower order byte) to R3
MOV A, R2 ; Move the result from R2 back to
In this case every event for counter operations or
accumulator A
machine cycles for timer operation, the TL1register
MOV @45H, A ; Store the higher order byte at address
will be incremented by 1. When the register pair
45H
overflows from FFH to 00H, then the TF1 of TCON
MOV A, R3 ; Move the carry from R3 to accumulator A
register will be high, also theTL1 will be reloaded with
MOV @46H, A ; Store the lower order byte at address
the content of TH1 and starts the operation again.
46H
Mode 3 of Timer/Counter- Mode 3 is different for
END ; End of the program
Timer0 and Timer1. When the Timer0 is working in
Q.24 What are Special Function Register
mode 3, the TL0 will be used as an 8-bit
A Special Function Register (or Special Purpose
timer/counter. It will be controlled by the standard
Register, or simply Special Register) is a register within
Timer0 control bits, T0 and INT0 inputs. The TH0 is
a microprocessor, which controls or monitors various
used as an 8-bit timer but not the counter. This is
aspects of the microprocessor's function. Depending
controlled by Timer1 Control bit TR1. When the TH0
on the processor architecture, this can include, but is
overflows from FFH to 00H, then TF1 is set to 1. In the
not limited to:
following diagram, we can Timer0 in Mode 3.
• I/O and peripheral control (such as serial ports
or general-purpose IOs)
• timers
• stack pointer
• stack limit (to prevent overflows)
• program counter
• subroutine return address
• processor status (servicing an interrupt,
Q26. Show bit patterns of TMOD SFR in 8051
running in protected mode, etc.) microcontroller
• condition codes (result of previous The Timer Mode (TMOD) Special Function Register
comparisons) (SFR) in the 8051 microcontroller is used to configure
Q 25. Explain Timer Mode 2 and Timer Mode 3 in the operating modes of the timer/counters (Timer 0
8051 microcontroller. and Timer 1). The bit patterns of TMOD SFR determine
Mode 1 of Timer/Counter- The Mode 1 operation is the modes of these timers.
the 16-bit timer or counter. In the following diagram, The TMOD register is an 8-bit register, and the bit
we are using Mode 1 for Timer0. pattern typically looks like this:
Mathematical Copy code
Bit Number: 7 6 5 4 3 2 1 0
TMOD Register: GATE C/T1# M1# C/T0# M0# GATE
C/T1 C/T0
In this case every event for counter operations or Here's the description of each bit:
machine cycles for timer operation, the TH0– TL0 • GATE (Gate Control): Bit 7 and Bit 3. These bits
register-pair will be incremented by 1. When the are used to control the gating of Timer 1 (T1)
register pair overflows from FFFFH to 0000H, then the and Timer 0 (T0). When these bits are set, the
TF0 of TCON register will be high, and it stops the timer is gated; when cleared, the timer runs
timer/counter. irrespective of the status of the external
Mode 2 of Timer/Counter - The Mode 2 operation is signal.
the 8-bit auto reload timer or counter. In the following • C/T1 and C/T0 (Timer/Counter Control): Bit 6
diagram, we are using Mode 2 for Timer1. and Bit 2. These bits determine whether
Timer 1 (T1) and Timer 0 (T0) operate in timer
mode or counter mode. When set, it
configures the respective timer as a timer, and
when cleared, it configures it as a counter.
• M1 and M0 (Mode Control): Bit 5 and Bit 1. • EX1 (External Interrupt 1 Enable/Disable): Bit
These bits, along with C/T1 and C/T0, 2. This bit enables or disables the interrupt
determine the operating modes (mode 0 to from External Interrupt 1 (INT1).
mode 3) of Timer 1 (T1) and Timer 0 (T0). • ET0 (Timer 0 Interrupt Enable/Disable): Bit 1.
• GATE (Gate Control): Bit 4. This bit is unused This bit enables or disables the interrupt from
in most 8051 variants and often referred to as Timer 0.
a "don't care" bit. • EX0 (External Interrupt 0 Enable/Disable): Bit
0. This bit enables or disables the interrupt
from External Interrupt 0 (INT0).
Q29. Write priority list of interrupt sources for 8051
Q27. State names of Interrupt sources of 8051 microcontroller.
microcontroller with interrupt vector addresses. 1. External Interrupt 0 (INT0):
1. External Interrupt 0 (INT0): • This interrupt has the highest priority
• Interrupt Vector Address: 0x0003 among the hardware interrupts.
• This interrupt is triggered by the INT0 • It is triggered by the INT0 pin (P3.2) of
pin (P3.2) of the 8051. the 8051.
2. External Interrupt 1 (INT1): 2. Timer 0 Overflow:
• Interrupt Vector Address: 0x001B • Timer 0 overflow interrupt takes
• This interrupt is triggered by the INT1 priority over Timer 1 overflow.
pin (P3.3) of the 8051. • Generated when Timer 0 overflows.
3. Timer 0 Overflow: 3. External Interrupt 1 (INT1):
• Interrupt Vector Address: 0x000B • This interrupt has lower priority
• This interrupt is generated when compared to INT0 but higher than
Timer 0 overflows. Timer 1 overflow.
4. Timer 1 Overflow: • Triggered by the INT1 pin (P3.3) of the
• Interrupt Vector Address: 0x0013 8051.
• This interrupt is generated when 4. Timer 1 Overflow:
Timer 1 overflows. • Timer 1 overflow interrupt has the
5. Serial Port (UART) Interrupt: lowest priority among the hardware
• Interrupt Vector Address: 0x0023 interrupts.
• This interrupt is generated by the • Generated when Timer 1 overflows.
UART when a byte is received or 5. Serial Port (UART) Interrupt:
transmitted. • This interrupt is of higher priority
Q28. Write bit patterns of "IE SFR" in 8051 compared to Timer and Serial Port
microcontroller with relevant diagram. interrupts but lower than the external
IE (Interrupt Enable) interrupts (INT0 and INT1).
The IE or Interrupt Enable Register is used to enable or • Generated by the UART when a byte is
disable individual interrupts. If a bit is SET, the received or transmitted.
corresponding interrupt is enabled and if the bit is Q30. Explain TMOD register.
cleared, the interrupt is disabled. The Bit7 of the IE TMOD (Timer Mode) Register
register i.e., EA bit is used to enable or disable all the Both Timer 0 and Timer 1 use the same register to set
interrupts. the various timer operation modes. It is an 8-bit
register in which the lower 4 bits are set aside for
Timer 0 and the upper four bits for Timers. In each
case, the lower 2 bits are used to set the timer mode
• EA (Global Interrupt Enable/Disable): Bit 7. in advance and the upper 2 bits are used to specify
This bit globally enables or disables all the location.
interrupts in the 8051 microcontroller. When
EA is set (1), interrupts are enabled, and when
it is cleared (0), interrupts are disabled.
• ES (Serial Port Interrupt Enable/Disable): Bit 4.
This bit enables or disables the interrupt from
the serial port (UART) of the 8051 Gate − When set, the timer only runs while INT(0,1) is
microcontroller. high.
• ET1 (Timer 1 Interrupt Enable/Disable): Bit 3. C/T − Counter/Timer select bit.
This bit enables or disables the interrupt from M1 − Mode bit 1.
Timer 1. M0 − Mode bit 0.
GATE (Gate Control): Bit 7 and Bit 3. communication link. It is a measure of the number of
• These bits control the gating of Timer 1 (T1) signal or symbol changes that occur per second. Baud
and Timer 0 (T0). rate is expressed in bits per second (bps) and indicates
• When set (1), the timer is gated, meaning it the rate at which individual bits are transmitted.
will only run when a logic high signal is Q33. Explain SBUF register.
present on the respective pin (TR1 for Timer 1 The SBUF (Serial Buffer) register is a crucial
and TR0 for Timer 0). component in microcontroller and microprocessor
C/T1 and C/T0 (Timer/Counter Control): Bit 6 and Bit 2 systems that facilitates serial communication. It's
• These bits determine whether Timer 1 (T1) commonly found in devices utilizing UART (Universal
and Timer 0 (T0) operate in timer mode or Asynchronous Receiver/Transmitter) or USART
counter mode. (Universal Synchronous/Asynchronous
• When set (1), it configures the respective Receiver/Transmitter) communication protocols.
timer as a timer, counting the internal clock The SBUF register serves as a temporary data storage
pulses. location during serial communication. When data is
M1 and M0 (Mode Control): Bit 5 and Bit 1. being transmitted, it holds the data to be sent out
• These bits, along with C/T1 and C/T0, serially via the Tx (transmit) pin. Conversely, during
determine the operating modes (mode 0 to reception, it stores incoming serial data received
mode 3) of Timer 1 (T1) and Timer 0 (T0). through the Rx (receive) pin until the microcontroller
• Different modes provide various or microprocessor can read and process it.
functionalities such as 13-bit or 16-bit Q34. Explain Mode 0, 1, 2, 3 in serial communication
timer/counter, auto-reload, and more. in 8051 microcontrollers.
Q31. Write a program for 8051 to generate a square Ans. Serial Data Mode-0 (Baud Rate Fixed)
wave of 50% duty cycle over port 1.0 • In this mode, the serial port works like a shift
To generate a square wave with a 50% duty cycle on register and the data transmission works
port 1.0 (P1.0) of the 8051 microcontroller, you can synchronously with a clock frequency of fosc
use Timer 0 in mode 1. Mode 1 of Timer 0 is an 8-bit /12.
timer/counter that can be configured to generate • Serial data is received and transmitted
square waveforms. Here's an example program: through RXD. 8 bits are transmitted/ received
ORG 0x0000 ; Define the origin address aty a time.
MOV TMOD, #01h ; Configure Timer 0 in mode 1 • The shift frequency or baud rate is always
LOOP: 1/12 of the oscillator frequency.
SETB P1.0 ; Set P1.0 high Serial Data Mode-1 (standard UART mode)
ACALL DELAY ; Call delay subroutine (baud rate is variable)
CLR P1.0 ; Clear P1.0 low • In mode-1, the serial port functions as a
ACALL DELAY ; Call delay subroutine standard Universal Asynchronous Receiver
SJMP LOOP ; Repeat the loop indefinitely Transmitter (UART) mode. 10 bits are
DELAY: transmitted through TXD or received through
MOV TH0, #0FCh ; Load high byte of initial value for RXD.
the delay • The 10 bits consist of one start bit (which is
MOV TL0, #0Ch ; Load low byte of initial value for the usually '0'), 8 data bits (LSB is sent
delay first/received first), and a stop bit (which is
SETB TR0 ; Start Timer 0 usually '1'). Once received, the stop bit goes
WAIT: into RB8 in the special function register SCON.
JNB TF0, WAIT ; Wait until Timer 0 overflows (50% of The baud rate is variable.
the delay) Serial Data Mode-2 Multiprocessor
CLR TF0 ; Clear Timer 0 overflow flag (baud rate is fixed)
RET ; Return from the subroutine • In this mode 11 bits are transmitted through
Q32. Define baud rate in serial communication TXD or received through RXD.
Baud rate is the rate at which the number of signal • The various bits are as follows: a start bit
elements or changes to the signal occurs per second (usually '0'), 8 data bits (LSB first), a
when it passes through a transmission medium. The programmable 9 th (TB8 or RB8)bit and a stop
higher a baud rate is the faster the data is bit (usually '1').
sent/received. • While transmitting, the 9 th data bit (TB8 in
Baud rate = number of signal elements/total time (in SCON) can be assigned the value '0' or '1'. For
seconds) example, if the information of parity is to be
In serial communication, baud rate refers to the speed transmitted, the parity bit (P) in PSW could be
at which data is transmitted over a serial f baud = (2 SMOD /64) fosc
Serial Data Mode-3 - Multi processor mode • Coordinates and controls the flow of
(Variable baud rate) data and instructions within the
• In this mode 11 bits are transmitted through processor.
TXD or received through RXD. • Generates timing and control signals
• The various bits are: a start bit (usually '0'), 8 necessary for the execution of
data bits (LSB first), a programmable 9 th bit instructions.
and a stop bit (usually '1'). 4. Instruction Register (IR):
Mode-3 is same as mode-2, except the fact that the • Stores the current instruction being
baud rate in mode-3 is variable (i.e., just as in mode1 f executed.
5. Program Counter (PC):
baud =(2 SMOD /32)*(fosc /12(256TH1)
• Keeps track of the memory address of
FROM BOOK the next instruction to be fetched and
Q.35 Basic concept of 8085 microprocessor executed.
architecture with functional block diagram. 6. Stack Pointer (SP):
The 8085 microprocessor is an 8-bit microprocessor • Manages the stack, used for
introduced by Intel in the late 1970s. It's a temporary storage of data during
fundamental component in many early computing subroutine calls and interrupts.
devices and laid the groundwork for subsequent 7. Address Bus and Data Bus:
microprocessor architectures. Here's a basic overview • Address Bus: Carries addresses of
of its architecture: memory locations and I/O devices.
• Data Bus: Carries data between the
microprocessor, memory, and
peripherals.
8. Interrupt Control:
• Handles interrupts, allowing external
devices to interrupt normal program
flow.
Basic Concept:
• Data and Instructions: The 8085 operates on
8-bit data and instructions.
• Instruction Set: It has a relatively simple
instruction set supporting operations like
arithmetic, logic, data transfer, branching, etc.
• Memory: The 8085 can address up to 64KB of
memory (16-bit address bus).
• I/O Interface: It interacts with I/O devices
using specific instructions and ports.
• Timing and Control: The control unit
generates timing signals to synchronize
Functional Block Diagram of 8085 Microprocessor:
1. Arithmetic Logic Unit (ALU): Q.36 Evolution of Microcontrollers.
• Responsible for performing arithmetic 1. First Generation: 1970s - 1980s
and logical operations. • The earliest microcontrollers emerged with
• Executes operations like addition, limited computational power and memory.
subtraction, AND, OR, etc. • Typically, 4-bit or 8-bit architectures.
2. Registers: • Examples: Intel 8048, Motorola 6800 series.
• Accumulator (A): Primary register for 2. Second Generation: Late 1980s - Early 1990s:
arithmetic and logic operations. • Advancements in semiconductor technology
• General Purpose Registers (B, C, D, E, led to more powerful and feature-rich
H, L): Used for various purposes like microcontrollers.
data manipulation, addressing, etc. • Increased bit width (8-bit to 16-bit) allowing
• Flag Register: Holds status flags
for more complex computations.
indicating the results of arithmetic
• Examples: Intel 8051, PIC microcontrollers,
operations (carry, zero, sign, parity,
Motorola 68HC11.
etc.).
3. Third Generation: Late 1990s - Early 2000s:
3. Control Unit:
• Significant enhancements in performance and
integration.
• Introduction of 32-bit microcontrollers with Q39. Block diagram of Microcomputer, elements of
higher computational power and larger Microcomputer, types of buses.
memory.
• Integrated with advanced peripherals and
interfaces (USB, Ethernet, CAN, etc.).
• Examples: ARM-based microcontrollers, Atmel
AVR32, Microchip PIC32.
4. Fourth Generation (Recent Trends): 2000s -
Present:
• Continued miniaturization and integration of
components into System-on-Chip (SoC)
designs.
• Increased focus on low power consumption Elements of a Microcomputer:
for IoT and portable devices. 1. CPU (Central Processing Unit): Executes
• More advanced connectivity options like instructions, performs calculations, and manages data
Bluetooth, Wi-Fi, and NFC. flow.
Q.37 Advantages of Microcontrollers 2. Memory: RAM (Random Access Memory): Volatile
• The flexibility Embedded Operating memory for temporary data storage.
System are specifying the processor chips that ROM (Read-Only Memory): Non-volatile memory
are due to the programmable nature. storing essential instructions.
• In fact, faster speed of execution is fully
3. Input Devices: Keyboard, Mouse, Sensors:
integrated into the processor such as a Instruments to input data into the microcomputer.
computer on a chip. 4.Output Devices: Display, Printer, Speakers:
• These devices are operating at a faster speed
Instruments to receive output from the
to executing the instructions to the general microcomputer.
purpose of microprocessors. 5.Buses: Data Bus: Transfers data between CPU,
• Programming the logical controllers (PLCs) are
memory, and peripherals.
subsets of the microcontrollers that will Address Bus: Carries memory addresses.
design the set of instructions for Control Bus: Manages communication and control
manufacturing the robots and also the signals.
industrial equipment planning for specific System Clock: Provides timing signals for
automated tasks. synchronization.
• More than one task may perform the PLCs and
Types of Buses:
microcontrollers are repetitive for human Data Bus: Transfers data between the CPU, memory,
attention. and peripherals.
Q.38 Applications of Microcontrollers Width can vary (e.g., 8-bit, 16-bit, 32-bit) determining
We know that microcontrollers are used for most of the amount of data transferred simultaneously.
the household and industrial applications. The huge Address Bus: Carries memory addresses from the CPU
areas of applications are as follows. to memory or peripherals.
• Evolution of Microcontrollers measuring the
Determines the maximum memory capacity a
physical quality for example force, microcomputer can address.
acceleration, stress, pressure, velocity an also Control Bus: Carries control signals (read, write, etc.)
strain. to coordinate data transfer and operations among
• The microcontroller is based upon the
components. Manages signals like clock signals,
laboratory instruments to measuring the interrupts, and control lines for various functions.
voltage, phase angle, energy, frequency and Q40. Need Of Microcontroller.
also power. Integration:
• Compactness: They integrate CPU, memory,
• Traffic light controlling system
• Robot ARM positioning control
I/O ports, timers, and other peripherals on a
• As a matter of fact, both the stepper motor
single chip, saving space and reducing
control and DC motor component count.
• Cost-Efficiency: Integration reduces the need
for multiple chips and components, leading to
lower manufacturing costs.
Control and Automation:
• Real-time Control: Microcontrollers excel at
real-time operations, making them ideal for
controlling processes and systems where • The ARM cortex microcontroller is an
timing and responsiveness are critical (e.g., advanced microcontroller in the ARM family,
robotics, automation). which is developed by the ARMv7
• Embedded Systems: They power countless architecture.
devices like washing machines, microwave Motorola 68HC11
ovens, automotive systems, and more, • The 68HC11 (6811 or HC11 for short) is an 8-
managing various functions efficiently. bit microcontroller (µC) family introduced
Flexibility and Customization: by Motorola in 1984.
• Programmability: They can be reprogrammed • It descended from the Motorola
easily, allowing for flexibility in adapting to 6800 microprocessor by way of the 6801.
different tasks or updating functionalities • It is a CISC (complex instruction set computer)
without changing hardware. microcontroller.
• Customization: Developers can tailor the AVR Microcontroller
microcontroller's functionality by • AVR is another member of microcontroller
programming it to suit specific application family.
requirements. • It is developed since 1996 by Atmel and
Low Power Consumption: acquired by Microchip Technology in 2016.
• Efficiency: Many microcontrollers are • It is an 8-bit RISC (Reduced Instruction Set
designed for low power consumption, making Computer) architecture microcontroller.
them suitable for battery-powered or energy- Q42. Versions of Microcontroller 8951, 89C1051,
efficient applications like IoT devices. 89C2051, 89C4051 with their specifications and
Q41. Family Of Microcontroller. comparison.
8051 microcontrollers 1. 8951:
In 1981, Intel introduced an 8-bit microcontroller • Bit Width: 8-bit
called the 8051 Microcontroller. It is based on • Memory: 4 KB of on-chip ROM, 128 bytes of
Harvard architecture and it is used as an embedded RAM
system. It is fabricate using VLSI technology. There are • Timers/Counters: Two 16-bit timers/counters
different types of microcontrollers existing in the • I/O Ports: 32 I/O pins
market now a day those are 4-bit, 8-bit, 64-bit & 128- • Serial Communication: UART (Universal
bit Asynchronous Receiver/Transmitter)
Feature Of 8051 Microcontroller • Clock Speed: Typically operates at frequencies
• 4KB bytes on-chip program memory (ROM) up to 12 MHz
• 128 bytes on-chip data memory (RAM) • Special Features: 5 interrupt sources, 8-bit
• Four register banks ( Bank 0- Bank 3) ADC (Analog-to-Digital Converter)
• 128 user defined software flags 2. 89C1051:
• 8-bit bidirectional data bus • Bit Width: 8-bit
• 16-bit unidirectional address bus • Memory: 4 KB of on-chip Flash memory, 128
• 32 general purpose registers each of 8-bit bytes of RAM
• 2- sixteen bit Timer/Counter ( Timer 0 and • Timers/Counters: Two 16-bit timers/counters
Timer 1) • I/O Ports: 15 I/O pins
PIC Microcontroller • Serial Communication: UART
• PIC stands for Peripheral Interface • Clock Speed: Typically operates at frequencies
Microcontroller up to 24 MHz
• PIC microcontroller was developed • Special Features: 2-level interrupt priority, low
in 1993 by Microchip Technology. power consumption
• PIC microcontrollers are the worlds 3. 89C2051:
smallest microcontrollers that can be • Bit Width: 8-bit
programmed to carry out a huge range of • Memory: 2 KB of on-chip Flash memory, 128
tasks. bytes of RAM
• It is based on Harvard memory architecture. • Timers/Counters: Two 16-bit timers/counters
• It is basically RISC microcontroller. • I/O Ports: 15 I/O pins
ARM Microcontroller • Serial Communication: UART
• The ARM stands for Advanced RISC machine . • Clock Speed: Typically operates at frequencies
• It was first introduced by the Acron up to 24 MHz
computers organization in 1987. • Special Features: Low voltage programming,
• ARM makes 32-bit and 64-bit RISC multi-core low power consumption
processors.
4. 89C4051:
• Bit Width: 8-bit Q.44 Pin diagram of microcontroller , function of
• Memory: 4 KB of on-chip Flash memory, 128 each pin.
bytes of RAM
• Timers/Counters: Two 16-bit timers/counters
• I/O Ports: 15 I/O pins
• Serial Communication: UART
• Clock Speed: Typically operates at frequencies
up to 24 MHz
• Special Features: Two-level interrupt priority,
low voltage programming
Comparison:
• Memory: The 8951 has on-chip ROM, while
the others (89C1051, 89C2051, 89C4051) use
Flash memory, allowing for reprogramming.
• I/O Pins: The 8951 offers more I/O pins (32)
compared to the others (15 pins).
• Memory Capacity: The 89C1051 and 89C4051
have larger Flash memory capacity (4 KB)
compared to 89C2051 (2 KB). Functions of Each Pin:
• Clock Speed: All operate at similar VCC (Pin 40): Power supply pin (usually +5V).
frequencies, with the 89C1051, 89C2051, and GND/VSS (Pin 20): Ground pin.
89C4051 capable of higher speeds (up to 24 Port Pins (P0, P1, P2, P3): Pins 1-32: I/O pins for
MHz) compared to the 8951 (up to 12 MHz). general-purpose interfacing.
• Special Features: Each variant has its own ALE/PROG (Pin 39):Address Latch Enable: Indicates the
specific additional features like interrupt availability of valid address/data on the bus during
priority, low power consumption, and external memory access or programming mode.
programming capabilities. PSEN (Pin 2):Program Store Enable: Used to fetch code
Q.43 Block diagram of 8051, function of each block. from external memory during program execution.
EA/VPP (Pin 1):External Access Enable/Voltage
Programming: Connects to VCC for normal operation
or to GND for code execution from an external ROM.
RST (Pin 11):Reset pin: When pulled low, resets the
microcontroller.
XTAL1, XTAL2 (Pins 29, 30):Crystal oscillator input and
output pins for connecting an external crystal for clock
generation.
Interrupt and Timer Pins (P3.2 to P3.7): Pins 14-19:
Used for external interrupts, timer inputs, and serial
Functions of Each Block: communication (RXD, TXD).
CPU: Executes instructions fetched from memory, Control Pins (RD, WR): Pins 21, 22: Read and Write
performs arithmetic/logic operations, and controls control pins for accessing external memory or I/O
data flow. devices.
Memory: Stores program instructions, data, and Q45 Difference between Internal and External
special function registers (SFRs) for controlling Memory
peripherals. Internal Memory External Memory
I/O Ports: Allows interfacing with external devices for Ram is volatile, but Non-volatile in
data input/output. ROM is non-volatile nature
Timers/Counters: Handles timing, counting, and in nature
generating time delays. It is also known as It is also known as
Serial Communication: Facilitates communication with Primary or main secondary memory
external devices via UART. memory
Interrupts: Handles priority-based interrupts, allowing Looks like chips and Look like a storage
the CPU to respond to external events promptly. is attached to the device or disk that
Clock Circuitry: Provides the timing signals required motherboard inside are portable and
for synchronization and operation of various the computer connects to every
components within the microcontroller. computer
Connects internally Connect through Clock Circuit:
by inserting chips or data cable or Synchronization: Provides a stable timing reference for
when the machine is externally to the the microcontroller's operations.
manufacture network Regulates Processing Speed: Controls the rate at
The Data is stored The Data is stored which instructions are executed.
temporarily to access permanently for Crystal Oscillator: A crystal component that generates
files faster long-term stable clock signals.
It is a working It is not a working Clock Generator: Generates clock signals based on the
memory memory crystal's oscillation frequency.
It cannot store It saves a broad Clock Divider: Divides the clock signal to produce
extensive data amount of data different frequencies for internal components.
Non-portable Portable Crystal Resonance: The crystal oscillates at a specific
Ram & Rom Hard Disk & Optical frequency when voltage is applied, providing a stable
Drive time base.
Q47. Internal RAM structure. Q49. Various registers and SFRs of 8051
Basic Structure: General-Purpose Registers (GPRs):
Memory Cells: Accumulator (ACC): Primary register for arithmetic
Fundamental Unit: Each memory cell stores a single and logic operation.
bit (0 or 1). Stores one of the operands during arithmetic/logic
Organization: Arranged in rows and columns forming a operations and accumulates results.
matrix-like structure. B, C, D, E Registers: Function: Additional general-
Addressing: purpose registers. Usage: Support various arithmetic,
Address Space: Divided into memory locations, each logic, and data manipulation operations.
location identified by a unique address. Special Function Registers (SFRs):
Address Width: Determines the total number of P0, P1, P2, P3 (Port Registers): Function: I/O port
addressable locations (2^n, where 'n' is the number of registers. Usage: Control and monitor the status of I/O
address lines). pins (input/output) of the microcontroller.
Data Bus: TCON (Timer/Counter Control): Function: Controls
Pathway for Data: Allows data to be read from or timer and counter operations. Usage: Manages
written to specific memory locations. external interrupts, timer modes, and control flags.
Width: Typically matches the CPU's data bus width (8- TMOD (Timer/Counter Mode): Function: Specifies the
bit, 16-bit, etc.). mode of operation for timers/counters. Usage: Sets
Registers and Buffers: the operating modes (timer/counter) and specifies
Address Register: Holds the address of the current timer/counting functions.
memory location being accessed. TH0, TL0, TH1, TL1 (Timer/Counter Registers):
Data Register: Temporarily stores the data being read Function: Timer/Counter registers. Usage: Hold the
from or written to the memory. values for timer/counter operations.
Control Logic: IE (Interrupt Enable): Function: Enables or disables
Decoding and Timing: Manages the flow of data interrupts. Usage: Controls the activation of interrupt
between the CPU and the memory. sources.
Q48. Reset and clock circuit. IP (Interrupt Priority): Function: Specifies interrupt
Reset Circuit: priority levels. Usage: Sets priority levels for different
Initialization: Resets the microcontroller to a known interrupt sources.
state upon power-up or system reset. PSW (Program Status Word): Function: Contains flags
Clears Registers: Clears internal registers, ensuring a for controlling the CPU and reporting status. Usage:
clean start for the CPU. Flags include carry, auxiliary carry, parity, and overflow
Reset Input (RST): An external pin that initiates a reset flags.
when pulled low. Control Registers:
Reset Generator: A circuit that generates a reset signal SP (Stack Pointer): Function: Points to the top of the
based on power-on, external signals, or watchdog stack memory. Usage: Manages the stack for
timers. subroutine calls and returns.
Power-On Reset (POR): Resets the microcontroller DPTR (Data Pointer): Function: Combined register for
when power is first applied. accessing external data memory. Usage: Used in
External Reset: Triggered by external events (e.g., accessing external memory locations.
pressing a reset button).
Q50. Various addressing modes of 8051 2. MOVC (Move Code) Format: MOVC A, @A+DPTR or
Immediate Addressing: Format: MOV A, #data MOVC A, @A+PC. Explanation: Moves a byte of code
Explanation: Data is directly specified within the from code memory to the Accumulator using the
instruction itself. DPTR or PC as the base address.
Direct Addressing: Format: MOV A, data_address 3. MOVX (Move External) Format: MOVX A, @DPTR or
Explanation: Data is accessed directly from a specific MOVX @DPTR, A. Explanation: Moves data between
memory location. the Accumulator and external memory using the Data
Register Addressing: Format: MOV A, R0 or MOV A, R1 Pointer (DPTR).
Explanation: Data is accessed directly from one of the 4. MOVX (Move External) for Indirect Addressing
eight general-purpose registers (R0 to R7). Format: MOVX A, @R0 or MOVX @R0, A. Explanation:
Register Indirect Addressing: Format: MOV A, @R0 or Moves data between the Accumulator and external
MOV A, @R1. Explanation: The content of the memory using Register Indirect Addressing with R0 or
memory location pointed to by a register is accessed R1.
(R0 or R1). 5. PUSH and POP. Format: PUSH and POP instructions
Indexed Addressing (DPTR): Format: MOVX A, @DPTR. are used to push data onto the stack or pop data from
Explanation: Data is accessed from the external the stack.
memory using the Data Pointer (DPTR) register. Q53. Arithmetic and Logical instructions of 8051.
Bit Addressing: Format: CLR bit address or SETB bit Arithmetic Instructions:
address. Explanation: Operates on specific bits in the ADD (Addition): Format: ADD A, operand
Special Function Registers (SFRs) or bit-addressable Explanation: Adds the operand to the Accumulator.
RAM locations. ADDC (Addition with Carry). Format: ADDC A,
Relative Addressing (Jump Instructions): Format: JMP operand. Explanation: Adds the operand and the carry
label or JZ label. Explanation: Instructions use labels as flag to the Accumulator.
operands to perform jumps or conditional branches. SUBB (Subtraction with Borrow): Format: SUBB A,
Register Bank Addressing: Format: MOV A, @R0 or operand. Explanation: Subtracts the operand and the
MOV A, @R1. Explanation: Accesses data indirectly carry flag from the Accumulator.
through banked registers (used in the 8051's banking INC (Increment): Format: INC operand. Explanation:
scheme). Increments the value of the operand by one.
Q51.Classification of instructions of 8051 DEC (Decrement): Format: DEC operand. Explanation:
1. Data Transfer Instructions: MOV: Move data from Decrements the value of the operand by one.
one location to another within the microcontroller's MUL (Multiplication) and DIV (Division): Format: MUL
memory or between registers and memory. AB and DIV AB. Explanation: Multiply and divide 8-bit
2. Arithmetic Instructions: ADD, SUB, MUL, DIV: numbers in the Accumulator and B register.
Perform arithmetic operations like addition, Logical Instructions:
subtraction, multiplication, and division. ANL (AND Logical Operation): Format: ANL
3. Logical Instructions: ANL, ORL, XRL: Perform logical destination, source. Explanation: Performs a bitwise
AND, OR, XOR operations on register/memory AND operation between the destination and source
contents. CJNE: Compare and jump if not equal. operands.
4.Branching and Looping Instructions: JMP, JC, JNC, ORL (OR Logical Operation): Format: ORL destination,
JZ, JNZ: Jump instructions based on certain conditions source Explanation: Performs a bitwise OR operation
(carry, zero, etc.). between the destination and source operands.
5. Bit Manipulation Instructions: SETB, CLR, CPL: Set, XRL (Exclusive OR Logical Operation):
clear, or complement specified bits in registers or Format: XRL destination, source. Explanation:
memory. ANL, ORL, XRL with bit addressing: Perform Performs a bitwise XOR operation between the
logical operations on individual bits. destination and source operands.
6. Stack Operation Instructions: PUSH, POP: Push CLR (Clear): Format: CLR bit_address. Explanation:
data onto the stack, pop data off the stack. Clears a specific bit in the Special Function Registers
7. I/O Instructions: IN, OUT: Input and output (SFRs) or RAM locations.
operations for interfacing with external devices. Q54. Branching instructions of 8051
8. Control Instructions: NOP: No operation. 1. JMP (Jump): Format: JMP label. Explanation:
SJMP, LCALL, RET, RETI: Subroutine and interrupt- Unconditional jump to the specified label/address in
related instructions. the program.
Q52. Data transfer instructions. 2. CJNE (Compare and Jump if Not Equal) Format:
1. MOV (Move) Format: MOV destination, source CJNE A, operand, label. Explanation: Compares the
Examples: MOV A, #data: Move immediate data to the Accumulator with the operand and jumps to the
Accumulator. MOV R0, R1: Move data from one specified label if they are not equal.
register to another.
3. DJNZ (Decrement and Jump if Not Zero) Format: Q56. Stack, subroutine and interrupt related
DJNZ operand, label. Explanation: Decrements the instructions of 8051
operand by 1 and jumps to the specified label if the Stack-Related Instructions:
result is not zero. PUSH (Push Accumulator): Format: PUSH
4. JC (Jump if Carry Set) and JNC (Jump if Carry Not Explanation: Pushes the contents of the Accumulator
Set) Format: JC label and JNC label. Explanation: onto the stack.
Conditional jump instructions based on the carry flag. POP (Pop Accumulator): Format: POP. Explanation:
JC jumps if the carry flag is set, and JNC jumps if the Pops the topmost value from the stack into the
carry flag is not set. Accumulator.
5. JZ (Jump if Zero) and JNZ (Jump if Not Zero) Format: PUSH and POP Direct (for Registers R0-R7): Format:
JZ label and JNZ label. Explanation: Conditional jump PUSH direct and POP direct. Explanation: Pushes/pops
instructions based on the zero flag. JZ jumps if the the contents of the specified register onto/from the
zero flag is set, and JNZ jumps if the zero flag is not stack.
set. Subroutine Call and Return Instructions:
6. SJMP (Short Jump) Format: SJMP label Explanation: CALL (Call Subroutine): Format: CALL address.
Unconditional short jump to the specified label within Explanation: Jumps to a subroutine located at the
a limited range (-128 to +127 bytes from the current specified address and saves the return address on the
instruction). stack.
Q55. Bit manipulation of 8051 RET (Return from Subroutine): Format: RET.
The 8051 microcontroller includes specific instructions Explanation: Returns from a subroutine, retrieving the
for bit manipulation that allow operations on return address from the stack.
individual bits within registers, memory locations, or RETI (Return from Interrupt): Format: RETI.
I/O ports. These instructions are crucial for setting, Explanation: Returns from an interrupt service routine
clearing, and testing specific bits, which is often (ISR) and restores the interrupt state.
necessary in embedded systems and interfacing with Interrupt-Related Instructions:
peripherals. Here are the main bit manipulation EI (Enable Interrupts): Format: EI. Explanation: Enables
instructions: interrupts, allowing the microcontroller to respond to
1. SETB (Set Bit): Format: SETB bit_address interrupts.
Explanation: Sets a specific bit in the Special Function DI (Disable Interrupts): Format: DI. Explanation:
Registers (SFRs) or RAM locations. Disables interrupts, preventing the microcontroller
2. CLR (Clear): Format: CLR bit_address from responding to interrupts.
Explanation: Clears a specific bit in the Special INT (Software Interrupt): Format: INT. Explanation:
Function Registers (SFRs) or RAM locations. Triggers a software-generated interrupt.
3. CPL (Complement): Q57.Software development steps.
Format: CPL bit_address. Explanation: Complements 1. Requirements Gathering:
(inverts) a specific bit in the Special Function Registers • Purpose: Understanding and documenting
(SFRs) or RAM locations. what the software should accomplish.
4. ANL (AND Logical Operation with Bit): Format: ANL • Activities: Interacting with stakeholders,
destination, #bit. Explanation: Performs a logical AND gathering and analyzing requirements,
operation between the destination operand and a bit defining scope, and creating a Requirements
mask. Specification document.
5. ORL (OR Logical Operation with Bit): Format: ORL 2. Planning:
destination, #bit. Explanation: Performs a logical OR • Purpose: Creating a roadmap for the project,
operation between the destination operand and a bit including timelines, resources, and
mask. deliverables.
6. XRL (Exclusive OR Logical Operation with Bit): • Activities: Setting goals, defining project
Format: XRL destination, #bit. Explanation: Performs a scope, creating a project plan, allocating
logical XOR operation between the destination resources, and establishing milestones.
operand and a bit mask. 3. Design:
7. RL (Rotate Left): Format: RL A. Explanation: Rotates • Purpose: Translating requirements into a
the Accumulator left through the carry bit. detailed technical design.
8. RR (Rotate Right): Format: RR A. Explanation: • Activities: Creating system architecture, high-
Rotates the Accumulator right through the carry bit. level and detailed design documents, UI/UX
design, database design, and outlining
algorithms or data structures.
4. Implementation (Coding): • Value: 0 = Disable, 1 = Enable.
• Purpose: Writing the actual code based on IE.1 - ET0:
the design specifications. • Purpose: Enable/Disable Timer 0 interrupt.
• Activities: Coding, unit testing, ensuring code • Value: 0 = Disable, 1 = Enable.
quality, and adhering to coding standards. IE.2 - EX1:
5. Testing: • Purpose: Enable/Disable external interrupt 1.
• Purpose: Verifying that the software meets • Value: 0 = Disable, 1 = Enable.
requirements and functions as intended. IE.3 - ET1:
• Activities: Different types of testing (unit • Purpose: Enable/Disable Timer 1 interrupt.
testing, integration testing, system testing, • Value: 0 = Disable, 1 = Enable.
user acceptance testing) to identify and fix IE.4 - ES:
defects. • Purpose: Enable/Disable Serial Port interrupt.
6. Deployment: • Value: 0 = Disable, 1 = Enable.
• Purpose: Releasing the software for users or
IE.5 - Reserved:
clients.
• Purpose: Reserved for future use.
• Activities: Packaging the software, preparing
IE.6 - Reserved:
documentation, setting up environments, and
• Purpose: Reserved for future use.
deploying the software into production or
IE.7 - EA:
distribution channels.
• Purpose: Global interrupt enable/disable
7. Maintenance and Support:
(master switch).
• Purpose: Ensuring the software continues to
• Value: 0 = Disable all interrupts, 1 = Enable all
function and evolve.
interrupts.
• Activities: Bug fixing, updates, enhancements,
PSW Register (Program Status Word):
user support, and addressing issues post-
The PSW register contains flags and control bits
deployment.
representing the processor's status and controlling
Q58. Bit configuration of IP, IE, PSW
certain operations.
IP Register (Interrupt Priority):
PSW.0 - P:
The IP register manages interrupt priority levels in the
8051 microcontrollers. It has various bits allocated to • Purpose: Parity flag.
different interrupt sources, allowing the programmer • Value: Set according to the parity of the
to prioritize interrupts. Accumulator after certain arithmetic
IP.0 - PX0: operations.
• Purpose: Priority level for external interrupt 0. PSW.1 - User-Defined:
• Value: 0 = Low Priority, 1 = High Priority. • Purpose: Available for user-defined purposes.
IP.1 - PT0: PSW.2 - OV:
• Purpose: Priority level for Timer 0 interrupt. • Purpose: Overflow flag.
• Value: 0 = Low Priority, 1 = High Priority. • Value: Set when an arithmetic operation
IP.2 - PX1: generates an overflow.
PSW.3 - RS0:
• Purpose: Priority level for external interrupt 1.
• Purpose: Register bank select 0 for data
• Value: 0 = Low Priority, 1 = High Priority.
pointer.
IP.3 - PT1:
• Value: Selects register bank 0.
• Purpose: Priority level for Timer 1 interrupt.
PSW.4 - RS1:
• Value: 0 = Low Priority, 1 = High Priority.
• Purpose: Register bank select 1 for data
IP.4 - PS:
pointer.
• Purpose: Reserved for future use.
• Value: Selects register bank 1.
IP.5 - P:
PSW.5 - F0:
• Purpose: Reserved for future use.
• Purpose: User-Defined flag.
IP.6 - Reserved:
• Value: User-Defined.
• Purpose: Reserved for future use.
PSW.6 - AC:
IP.7 - Reserved:
• Purpose: Auxiliary Carry flag.
• Purpose: Reserved for future use.
IE Register (Interrupt Enable): • Value: Set when an auxiliary carry occurs in
The IE register controls the enabling or disabling of arithmetic operations.
interrupts in the 8051 microcontrollers. PSW.7 - CY:
IE.0 - EX0: • Purpose: Carry flag.
• Purpose: Enable/Disable external interrupt 0. • Value: Set when an arithmetic operation
generates a carry or borrow.
Q59.Pin diagram of microprocessor 3. Linker: Purpose: Combines multiple object files and
libraries into a single executable program. Function:
Resolves references between different modules,
Examples: Keil μVision, SDCC (Small Device C
Compiler).
4. Loader: Purpose: Loads the executable program
into the microcontroller's memory. Function: Transfers
the program from the development environment (PC)
to the target microcontroller's memory (RAM or
ROM). Examples: Some IDEs like Keil provide built-in
loaders.
5. Hex Converter: Purpose: Converts binary or object
files into hexadecimal format. Function: Generates a
hexadecimal file that represents the machine code
instructions for programming the microcontroller's
memory (EPROM/Flash). Examples: Utilities provided
by IDEs like Keil, standalone converters.
Q61 . Related SFRs (Special Function Registers) for
Address bus- A15-A8, it carries the most significant 8- Serial Communication in the 8051
bits of memory/IO address. Related SFRs (Special Function Registers) for Serial
Data bus- AD7-AD0, it carries the least significant 8-bit Communication in the 8051:
address and data bus. 1. SCON (Serial Control Register):
Control and status signals- These signals are used to • Purpose: Controls the serial port
identify the nature of operation. There are 3 control mode and status.
signal and 3 status signals. • Bits: SCON.0 to SCON.7 control
Three control signals are RD, WR & ALE. various serial port settings.
IO/M- This signal is used to differentiate between IO 2. SBUF (Serial Buffer Register):
and Memory operations, i.e. when it is high indicates • Purpose: Holds the data to be
IO operation and when it is low then it indicates transmitted or received.
memory operation. 3. PCON (Power Control Register - SM0 and
S1 & S0- These signals are used to identify the type of SM1):
current operation. • Purpose: Selects the UART mode
Power supply- There are 2 power supply signals − VCC (serial port modes).
& VSS. VCC indicates +5v power supply and VSS Programming Modes:
indicates ground signal. The 8051 UART supports various modes:
Clock signals- There are 3 clock signals, i.e. X1, X2, CLK • Mode 0: 8-bit UART, variable baud rate.
OUT. • Mode 1: 8-bit UART, fixed baud rate.
Interrupts & externally initiated signals- Interrupts are Q.62 Interrupts- related SFRs, types, operations
the signals generated by external devices to request Related SFRs for Interrupts:
the microprocessor to perform a task. IE (Interrupt Enable Register): Purpose: Enables or
Serial I/O signals- There are 2 serial signals, i.e. SID disables interrupts globally or individually. Bits: IE.0 to
and SOD and these signals are used for serial IE.7 control specific interrupt enable/disable flags for
communication. various sources.
Q60.Software development tools like Editor, IP (Interrupt Priority Register): Purpose: Sets the
Assembler, Linker, Loader and Hex priority levels for different interrupts. Bits: IP.0 to IP.7
converters. determine the priority levels for each interrupt source.
1. Editor- Used for writing and editing source code. EA (Global Interrupt Enable): Purpose: Globally
Function: Provides a user interface for writing code enables or disables all interrupts. Bit: EA enables or
with features like syntax highlighting. Examples: disables all interrupts when set or cleared,
Notepad++. respectively.
2. Assembler: Purpose: Translates assembly language Interrupt Flags (TF0, TF1, IE0, IE1, RI, TI, etc.): Purpose:
code into machine code (object code). Function: Flags indicating specific interrupt events or conditions.
Converts mnemonic instructions into binary machine Bits: TF0, TF1 for Timer 0/1 overflow, IE0, IE1 for
code that the microcontroller can understand. external interrupts, RI/TI for serial communication,
Examples: Keil μVision, AS31 etc.
Operations Related to Interrupts:
Enabling and Disabling Interrupts: Using the EA
(Global Interrupt Enable) bit to enable or disable all
interrupts.
Setting Interrupt Priority Levels: Using IP to set priority
levels for different interrupt sources. Higher values
indicate higher priority.
Clearing Interrupt Flags: Clearing specific interrupt
flags (TI, RI, etc.) after handling interrupts to avoid re-
triggering.
Interrupt Service Routines (ISRs): Writing code to
handle specific interrupt events in ISRs.
Interrupt Vector Table: Contains addresses of the ISR
for each interrupt type.
Types of Interrupts in the 8051:
External Hardware Interrupts (INT0, INT1): Source:
Triggered by external hardware signals on P3.2 (INT0)
and P3.3 (INT1).
Timer Interrupts (TF0, TF1): Source: Generated by
Timer 0 (TF0) and Timer 1 (TF1) overflows.
Serial Communication Interrupts (RI, TI): Source:
Generated by serial communication events (receive -
RI, transmit - TI).
Q63. Operation of Overcurrent Relay:
Ans. Sensing Circuit
Current Measurement
Threshold Setting
Trip Decision
Tripping Action
Time Delay (Optional)
Reset and Restoration
Q64.Speed control of D.C. motor.
Ans. Voltage Control:
2. Armature Voltage Control:
3. Field Flux Control:
4. PWM (Pulse Width Modulation):
5. Feedback Control (Closed-Loop Control):
6. Electronic Speed Controllers (ESC):
7. Using Motor Speed Control Units:
Q64.Microcomputer Block Diagram

You might also like