ELTR-363 Micro Controller Programming and Application .
ELTR-363 Micro Controller Programming and Application .
By ANAS 1 WWW.DAENOTES1.COM
➢Chapter#1 Micro-controller Basics
Short Question’s
Q1: Define Micro-controller?
Ans: A compact computer on a single VLSI integrated circuit
chip, used for specific functions is called a microcontroller.
Q2: Draw general block diagram of Micro-controller?
Ans:
CPU ROM RAM
Serial Times I/O Ports
Interface
Q3: Enlist parts of micro controller?
Ans:
1) CPU
2) RAM
3) ROM
4) Input/Output Ports
Q4: Explain the need for microcontroller programming?
Ans: Microcontroller programming means coding of a
microcontroller for different purposes in a special software.
By ANAS 2 WWW.DAENOTES1.COM
There are lots of software in which we can write different
codes for microcontroller and IC Chips. Microcontrollers are
typically programmed in higher-level languages such as C++
or Java. One of the essential tools needed to program a
microcontroller is an integrated development environment
(IDE).
Q5: What is the difference between Microcontroller and
Microprocessor?
Ans:
1) Microcontrollers are designed for special purposes while
microprocessors are designed for general purposes.
2) Microcontrollers have a small instruction set while
microprocessors have a large instruction set.
Q6: What is embedded System?
Ans: An embedded system is a combination of computer
hardware and software designed for a specific function.
Embedded systems may also function within a larger system.
The systems can be programmable or have a fixed
functionality.
Examples:
1) Automobiles.
Modern cars commonly consist of many computers
(sometimes as many as 100), or embedded systems,
designed to perform different tasks within the vehicle. Some
of these systems perform basic utility functions and others
provide entertainment or user-facing functions. Some
embedded systems in consumer vehicles include cruise
By ANAS 3 WWW.DAENOTES1.COM
control, backup sensors, suspension control, navigation
systems and airbag systems.
2) Mobile phones
These consist of many embedded systems, including GUI
software and hardware, operating systems (OSes), cameras,
microphones, and USB (Universal Serial Bus) I/O
(input/output) modules.
3) Industrial machines
They can contain embedded systems, like sensors, and can
be embedded systems themselves. Industrial machines often
have embedded automation systems that perform specific
monitoring and control functions.
Q7: What Criteria/factors are considered in selecting a
microcontroller?
Ans: One of the microcontrollers with different features from
many companies available in the market for a specific task.
Below are some specific and important features of the micro-
controller which must be considered while choosing the
micro-controller are given.
By ANAS 4 WWW.DAENOTES1.COM
6) Flexibility
7) Availability of spare parts.
8) Present and future provision
Q8: Write four examples of embedded system?
Ans:
1) Printer
2) Keyboard
3) Mouse
4) Speed o meter
5) Digital cameras.
6) Digital wristwatches.
7) MP3 players.
8) Temperature measurement systems.
9) Calculators.
Q9: Define Program?
Ans: A set of instructions given to the computer to solve a
problem is called program. A computer works according to
the instructions written in program.
Q10: Write four uses of micro-controller in industry?
Ans:
1) Robots
2) Machine Control
3) Packing Process
4) Automobiles
Q11: Define Program Algorithm?
By ANAS 5 WWW.DAENOTES1.COM
Ans: The sequential steps required to solve a
question/problem are called program Algorithm.
Q12: Name the two modes of expression of Algorithm?
Ans: Programs and Flow chart are two modes of expression
of Algorithm.
Q13: Define Flow Chart?
Ans: Flowchart is combination of two words flow and chart. A
chart consists of different symbols to display information
about any program. Flowchart is a graphical representation
of an algorithm. It is used to represent Algorithm in diagram
form by various symbols.
Q14: What is meant by Pseudocode?
Ans: Writing and displaying Algorithm in common language
like English or German etc. is called Pseudocode.
Q15: Write the names of the four symbols used in the
flowchart?
Ans:
1) Terminal
2) Subroutine
3) Connector
4) Process
Q16: Describe Flow Chart Symbols?
Ans:
Flow Chart Symbols are as Follows;
By ANAS 6 WWW.DAENOTES1.COM
1) Terminals
2) Input/Output
3) Processing
4) Subroutine
5) Decision
6) Flow Lines
7) Connectors
1) Terminals
By ANAS 7 WWW.DAENOTES1.COM
Oval is used to represent the start or end of the flow chart. It
is also called terminal.
Terminal
Terminal
2) Input/Output
Parallelogram is Used to represent an input or output step in
flowchart.
Input/Out
put
3) Processing
Rectangle is used to represent a processing or computational
operation in the flowchart.
4) Subroutine
Subroutine refers to programs that are not part of the main
program but need again and again in the main program. It is
also represented by a rectangular symbol, but have an extra
line on both sides.
By ANAS 8 WWW.DAENOTES1.COM
5) Decision
Diamond symbol is used to represent decision step in the
flowchart. The flow of control from diamond may go in two
possible directions. It goes to one direction if the condition is
TRUE or YES and to second direction if the condition is FALSE
or NO.
Diamond
6) Flow Lines
Arrows are used to represent the direction of flow in the
flowchart. There are four flow lines to represent four
directions.
7) Connectors
Circle symbol is used to combine different flow lines. It is
used when two or more flow symbols come from different
directions and move to one direction.
By ANAS 9 WWW.DAENOTES1.COM
Q16: Describe Levels of Flowchart?
Ans: The level of the flowchart refers to the information
given in the flowchart. There are no standards in this regard.
A flow chart that gives a large and detailed description of a
program is called a macro flowchart.
Q17: Describe Advantages and Disadvantages of flowchart?
Ans:
• Advantages
i. Effective Analysis
ii. Effective Synthesis
iii. Efficient Coding
iv. Proper Documentation
v. Efficient Program Maintenance
• Disadvantages
i. Time Consuming
ii. Difficult to Show Branching and Looping
iii. is Visualization Program
iv. Making changes in flowchart is very difficult task
Q18: Draw simple block diagram of microprocessor?
Ans:
By ANAS 10 WWW.DAENOTES1.COM
Q19: Write the steps in order to match the microcontroller?
Ans:
1) Creating program algorithms
2) Translation of assembly language into machine language
3) Decoding of Machine language
Q20: Describe Limitations of Microcontroller?
Ans:
• It has a complex structure.
• The microcontroller cannot interface a higher power
device directly.
Q21: Define Programming?
Ans: Programming is the process of creating a set of
instructions that tell a computer how to perform a task.
Programming can be done using a variety of computer
programming languages, such as JavaScript, Python, and C++
Q22: Write difference b/w microprocessor and
microcontroller?
Ans:
SR# Microcontroller Microprocessor
1 Used for control purposes. Used for general purposes.
2 It is located on a single It requires External devices
VLSI integrated circuit
chip,
3 Its instruction set is small. Its instruction set is large.
4 Its size is small Its size is large
5 Power consumption is Power consumption is high.
less.
By ANAS 11 WWW.DAENOTES1.COM
Q23: Why flowchart is used in programming?
Ans: In microcontroller programming, flowcharts are used to
clearly show all the steps of the program sequentially.
Q24: Which device is programmable?
Ans: Microcontroller is a programmable device.
Q25: Write about CPU?
Ans: The Central Processing Unit (CPU) is the brain of
computer. It is the most important component of a
computer. It is also called processor. A computer cannot
work without CPU. All computers must have a central
processing unit. The primary work of CPU is as follows:
• It accepts data.
• It processes data.
• It provides output in useful information to be used by user
or computer program.
CPU is located on the motherboard. It performs all
operations on data according to the given instructions. It can
perform arithmetic and logical operations like addition,
subtraction etc. It executes instructions and tells other parts
of computer what to do. CPU consists of two main units
called ALU (Arithmetic and Logic Unit) and CU (Control unit).
By ANAS 12 WWW.DAENOTES1.COM
• Chapter#2 Microcontroller Architecture
Short questions
Q1: Define the architecture of microcontroller?
Ans: The arrangement of the hardware of the various devices
and the capability of the devices inside the microcontroller
chip is called the architecture organization of the
microcontroller.
Q2: Define bit address able RAM?
Ans: RAM whose individual bits can be addressed is called
bit-addressable RAM.
Q3: Describe types of Microcontrollers according to their
architecture?
Ans:
• Harvard architecture
• von Neumann architecture
Q4: Define von Neumann architecture?
Ans: A type of Microcontroller architecture in which data and
instructions are fetched from same memory through a single
data bus is called von Neumann architecture
Q5: Describe Advantages of von Neumann Microcontroller
Architecture?
Ans:
i. Design and development of the Control Unit is
simplified
By ANAS 13 WWW.DAENOTES1.COM
ii. It is cheaper
iii. Less physical space is required than Harvard
Q6: Describe Dis-advantages of von Neumann
Microcontroller Architecture?
Ans:
i. Its speed is slow
ii. Memory leaks
iii. CPU cannot access instructions and read/write at the
same time.
Q7: Define Harvard architecture?
Ans: A type of microcontroller architecture which have
separate data bus and separate address bus is called Harvard
Microcontroller architecture.
Q8: Describe Advantages and Dis-advantages of Harvard
Microcontroller architecture?
Ans:
➢ Advantages
i. Its speed is faster
ii. CPU can access instructions and read/write at the same
time.
➢ Dis-advantages
i. Its design is very complex
ii. It is costly than Von Neumann Architecture.
Q9: Difference between Von Neumann Architecture and
Harvard Architecture?
Ans:
By ANAS 14 WWW.DAENOTES1.COM
SR# Von Neumann Architecture Harvard architecture
1: It is ancient computer architecture It is modern computer architecture based
based on stored program on Harvard Mark I relay based model.
computer concept.
2: Same physical memory address is Separate physical memory address is used
used for instructions and data. for instructions and data.
3: There is common bus for data and Separate buses are used for transferring
instruction transfer. data and instruction.
4: Two clock cycles are required to An instruction is executed in a single cycle.
execute single instruction.
5: It is cheaper in cost. It is costly than Von Neumann Architecture.
6: CPU cannot access instructions and CPU can access instructions and read/write
read/write at the same time. at the same time.
7: It is used in personal computers It is used in micro controllers and signal
and small computers. processing.
By ANAS 15 WWW.DAENOTES1.COM
Q14: What is the last address of 8051 Family?
Ans: OFFFH
Q15: What is program Counter?
Ans: A program counter is a register in a computer processor
that contains the address (location) of the instruction being
executed at the current time.
Q16: How program counter works?
Ans: A program counter is a register in a computer processor
that contains the address (location) of the instruction being
executed at the current time. As each instruction gets
fetched, the program counter increases its stored value by 1.
After each instruction is fetched, the program counter points
to the next instruction in the sequence. When the computer
restarts or is reset, the program counter normally reverts to
0.
Q17: Define the program counter of 8051?
Ans: The program counter of 8051 is a 16-bit register. It is
capable of addressing 64 kilobytes from 0000 to FFFFH.
Q18: Describe Instruction Register and Instruction Decoder?
Ans: To execute an instruction, the processor copies the
instruction code from the program memory into the
instruction register (IR). Then it can be decoded (interpreted)
by the instruction decoder, which is a combinational logic
block which sets up the processor control lines as required.
Q19: What is RAM
Ans: RAM stands for random access memory. It is also called
primary memory or direct access memory. It means that each
By ANAS 16 WWW.DAENOTES1.COM
byte in the memory can be accessed directly. Any location in
RAM can be accessed in the same amount of time. RAM is
used to store data and instructions temporarily. Most
desktop computers typically have 4 GB of RAM or more.
CPU can perform only two types of operations on RAM as
follows:
1. Read
CPU can read data from RAM. The contents of memory
location are copied to CPU register in this operation.
2. Write
CPU can write data to RAM. The contents of CPU register are
copied to the memory location in this operation.
➢ Characteristics of RAM
The main characteristics of RAM are as follows:
• RAM is volatile memory. Its contents are lost when the
power is turned off.
• RAM is read/write memory. CPU can read data from and
write data to RAM.
• RAM is random access because any part of RAM can be
accessed randomly.
➢ TYPES OF RAM
i. DRAM (Dynamic Random Access Memory)
ii. SRAM (Static Random Access Memory)
Q20: Define the RAM of 8051?
Ans: The RAM of 8051 is 128 bytes. It is divided into three
By ANAS 17 WWW.DAENOTES1.COM
groups. 32 bytes for register bank and stack, 16 bytes are
allocated for bit-addressable registers and 80 bytes are
allocated for patch speed.
Q21: Define stack?
Ans: A stack refers to a place where the CPU temporarily
stores data or information containing address or data. The
stack is a part of RAM, and the stack pointer register is used
to point to it.
Q22: Which instructions are used to Read and write a data
in the stack?
Ans: PUSH and POP
Q23: What is the function of Microcontroller Timing and
Control Unit?
Ans: Microcontroller Timing and Control Unit is a sequential
circuit. It provides timing and control signals for coordination
and program execution across all parts of the chip. All the
operations and functions both interior and exterior are
controlled by this unit.
Q24: Describe 8051 Timers?
Ans: 8051 has two timers, one is T0 and the other is T1.
Basically, both of these are 16-bit registers. Timers are also
used as timers and also as counters.
Q25: What is the function of Timers?
Ans: Timers are used to generate time delays, to provide
timing signals, as counters to count various events, and to
generate clock signals.
By ANAS 18 WWW.DAENOTES1.COM
Q26: What is meant by stack pointer?
Ans: A stack pointer is a small 8bit register used to point to
data stored in the stack.
Q27: What is ALU and CU?
Ans:
• ALU
ALU stands for Arithmetic and Logic Unit. It is a
combinational logic circuit. ALU performs all arithmetic and
logical operations on data. The actual execution of
instructions takes place in ALU. It consists of arithmetic unit
and logic unit.
i. Arithmetic Unit
The arithmetic unit performs the arithmetic operations such
as addition, subtraction, multiplication and division. Some
examples of arithmetic operations are as follows:
15+3=18
10*2=20
50 / 5 = 10
ii. Logic Unit
Logic unit of ALU performs the logical operations. A logical
operation is usually a comparison of numbers, letters or
special characters. A comparison operation is performed to
make decision. A computer can take a specific action based
on the result of a comparison. It is an important capability of
a computer.
By ANAS 19 WWW.DAENOTES1.COM
• CU
Control unit is an important component of CPU. It generates
signals to direct the entire computer system. It controls and
coordinates all activities of computer system. It does not
execute program instruction by itself. It directs other parts of
computer to perform different tasks. Control unit
communicates with arithmetic and logical unit, memory and
other parts of computer system. Control unit also provides
clock pulses. The pulses are used to regulate and control the
speed of all operations in computer.
Q28: What is Accumulator?
Ans: An accumulator is a part of ALU. It is a type of register
included in a CPU. It acts as a temporary storage location
which holds an intermediate value in mathematical and
logical calculations.
Q29: Describe Port registers of Microcontroller?
Ans: The registers attached to the in/out port of the
microcontroller are called port registers.
Q30: What is meant by special function registers?
Ans: Such registers which are used to control the mode of
operations of microcontrollers and to record the rates of
operations are called special function registers. For example,
a program counter is an SFR.
Q31: Write the names of two special function registers of
PIC microcontrollers.
Ans:
1) PCL
By ANAS 20 WWW.DAENOTES1.COM
2) STATUS
Q32: Name two special function register of 8051?
Ans:
1) Accumulator
2) Program counter
Q33: TMOD stands for?
Ans: Timer Mode Control (TMOD)
Q34: DPTR stands for?
Ans: Data Pointer (DPTR)
Q35: TCON stands for?
Ans: Timer Control Register (TCON)
Q36: What is PSEN pin? Through which pin of 8051 the
external ROM is accessed?
Ans: PSEN stands for Program Store Enable. It is output,
active-low pin. This is used to read external memory. In 8031
based system where, external ROM holds the program code,
this pin is connected to the OE pin of the ROM.
Q37: Define EA pin?
Ans: The Pin 30 of 8051 is EA pin which stands for External
Access input. It is used to enable/disable the external
memory interfacing.
Q38: Define ALE pin?
Ans: The Pin 31 of 8051 is ALE pin which stands for Address
Latch Enable. It is used to demultiplex the address-data signal
of port.
By ANAS 21 WWW.DAENOTES1.COM
Q39: Define RST pin?
Ans: RST is an active high reset input pin. The microcontroller
is Reset by applying a logic high to it.
Q40: Enlist the names of buses used in microcontroller?
Ans:
1) Data Bus
2) Address Bus
3) Control Bus
Q41: Define Bus?
Ans: A computer system consists of different devices. CPU
must be able to communicate with all devices. The devices
are connected together by a communications channel called
bus. A bus consists of a set of communication lines or wires.
These lines are used to move a large amount of bits in the
form of electrical pulses from one unit to another.
The bus is used to connect the following units:
1) Central Processing Unit
2) Control Unit
3) Arithmetic and Logic Unit
4) Main Memory (RAM, ROM)
5) Input/Output Devices
Bus is a common path to transfer data and commands
between CPU, memory and input/output devices. It is also
used to send or receive data from secondary storage. The
capacity of a bus depends on the number of data lines in it.
The amount of data that a bus can carry at one time is called
bus width. For example, a bus with 32 lines can carry 32 bits
By ANAS 22 WWW.DAENOTES1.COM
or + bytes at a time. A higher bus width means that the bus
can carry more data. It increases the performance of the
computer.
The speed at which data moves from one component to
another component of the computer is called bus speed. It
affects the overall performance of the computer. Bus clock
speed is measured in units of megahertz (MHz) or millions of
clock cycles per second.
• Types
1) Data Bus
2) Address Bus
3) Control Bus
1) Data Bus
Data bus is used to transfer data between different
components of the computer. For example, it transfers
instructions from memory to CPU for execution. It also
transfers data between memory and the I/O during
input/output operations. The number of lines in data bus
affects the speed of data transfer between different
components. A data bus with more lines can carry more data.
A computer with 32-line data bus can transfer 32 bits of data
at one time. A computer with 64-line data bus can transfer 64
bits of data at one time. The data bus lines are bi-directional
and can carry data to or from memory.
2) Address Bus
By ANAS 23 WWW.DAENOTES1.COM
Address bus is used to connect the CPU with main memory to
identify particular addresses in main memory. The number of
lines in the address bus determines the amount of memory
that can be directly addressed. A computer with a 32-bit
address bus can directly address 4GB of physical memory.
The address bus is a unidirectional bus. It can carry
information only in one direction. It carries address of
memory location from CPU to the main memory. The newer
computers are using a 64-bit address bus.
3) Control Bus
Control bus is used to carry control information from control
unit to other units. The directs the transfer of data from
memory to ALU. The ALU uses this data for processing. The
control information is used to direct the activities of all units.
For example, the control unit control unit also controls the
functioning of other units through control bus like
input/output devices and secondary storage devices etc.
By ANAS 24 WWW.DAENOTES1.COM
Q44: PSW stands for?
Ans: PSW stands for Program Status Word.
Q45: What is the difference between PUSH and POP?
Ans: A stack has two main operations that occur only at the
top of the stack: push and pop. The push operation places an
element at the top of stack whereas the pop operation
removes an element from the top of the stack.
Q46: What is the function of I/O ports?
Ans: input/output pins allow the microcontroller to be
connected with the peripheral devices. We can use the pins
of microcontroller as input or output by programming, that’s
why these are called in/out ports.
Q47: What is the function of Oscillator in microcontroller?
Ans: Oscillators are responsible for supplying the clock
signals in microcontrollers. All the instructions executed by
microcontrollers are in synchronization with clock signals.
The timing for different operations in a microcontroller is
assigned with the help of oscillators.
Q48: Define FLAGS register?
Ans: The FLAGS register is the status register that contains
the current state of a x86 CPU. It is also called PSW Register
in 8051. It is 8bit register.
Q49: What is carry flag?
Ans: In computer processors the carry flag is a single bit in a
system status register/flag register used to indicate when an
arithmetic carry or borrow has been generated out of the
most significant arithmetic logic unit bit position.
By ANAS 25 WWW.DAENOTES1.COM
Q50: What is Auxiliary carry flag (AC)?
Ans: Auxiliary Carry Flag (AF) is one of the six status flags in
the 8086 Microprocessor.
• This flag is used in BCD (Binary-coded Decimal)
operations.
• The status of this flag is updated for every arithmetic or
logical operation performed by ALU.
• This flag is set to one if there is a CARRY from the lower
nibble or BORROW for the lower nibble in binary
representation.
• Else it is set to zero.
Q51: Define Parity flag (P)?
Ans: This is a bit of the flag register that represents the
number of 1s in the Accumulator. If the number 1s is an odd
number, this bit is high otherwise zero.
Q52: Define Overflow Flag (O)?
Ans: This flag will be set (1) if the result of a signed operation
is too large to fit in the number of bits available to represent
it, otherwise reset (0).
Q53: What is the size of ROM in 8051?
Ans: The standard 8051 comes with 4KB ROM, 128 bytes
RAM, Four 8bit ports and 2 timer counters. Other members
of the family are the ROMless 8031, 8052 with 256 bytes of
RAM and 3 counter/timers etc.
By ANAS 26 WWW.DAENOTES1.COM
Q54: What is value of program counter when we give the
power to 8051 Microcontroller?
Ans: The value of program counter when we give the power
to 8051 Microcontroller is ‘0000’
Q55: Write characteristics of 8051 Microcontroller?
Ans:
• RAM: 8051 Microcontroller has 128KB (kilo Bytes) of RAM
which includes SFRs and Input / Output Port Registers.
• ROM: 8051 has 4KB of on-chip ROM (Program Memory).
• I/O Ports: 8051 has four 8 – bit Input / Output Ports which
are bit addressable and bidirectional.
• Timers / Counters: 8051 has two 16 – bit Timers /
Counters.
Q56: How many (KB) kilo in 1 (MB) mega Memory?
Ans: There are 1024kb in 1mb.
Q57: Which port in 8051 microcontroller requires external
resistors to use port as in-out.
Ans: Port 0
Q58: Define DPTR?
Ans: In 8051 Microcontroller the DPTR (Data Pointer) is a
16bit register. It is a combination of two 8bits register (DPH
and DPL). It is used to access external memory using the
address indicated by DPTR.
Q59: What is the difference b/w Carry flag and Over flow
flag?
Ans: During addition and subtraction of the (singed)
By ANAS 27 WWW.DAENOTES1.COM
numbers, if the size of the answer is greater than or less than
8 bits, it is indicated by the over flow flag. Whereas, if the
result of addition and subtraction of (unsigned) numbers is
more than or less than 8 bits, it is shown by the carry flag.
Q60: Enlist names of 8051bit address register?
Ans: PSW, TCON, SCON and Accumulator etc.
Q61: What is the benefit of having bit addressability of 8051
in/out ports?
Ans: The advantage of 8051's ports being bit addressable is
that we can change any bit of any port individually by
addressing it.
Q62: What is the use of PUSH Instruction?
Ans: The PUSH instruction increments the stack pointer and
transfer data to the stack. No flags are affected by this
instruction.
Q63: What is the use of Push and POP instruction?
Ans: The push and pop instructions are used to save and load
values from the stack. The stack is a data structure that is
used to store data in a last-in, first-out (LIFO) manner. The
push instruction adds a value to the top of the stack, while
the pop instruction removes the top value from the stack.
Q64: Define POP instruction?
Ans: The instruction used to fetch data from the stack of
8051 is called POP.
Q65: Why RAM is called volatile memory?
By ANAS 28 WWW.DAENOTES1.COM
Ans: RAM is called volatile memory because it lost its
contents when the power is turned off.
Q66: How many bytes in 20kilobytes?
Ans: There are 20,480 bytes in 20kb (20 x 1024 = 20480).
Q67: What is the difference between data bus and address
bus?
Ans:
Data Bus Address Bus
It is a communication route through It is the connection between the CPU
which data can travel between the and the main memory.
computer’s CPU, memory, and
peripherals.
Data bus is used to transfer data Address bus is used to connect the
between different components of CPU with main memory to identify
the computer. particular addresses in main
memory.
A computer with 32-line data bus A computer with a 32-bit address bus
can transfer 32 bits of data at one can directly address 4GB of physical
time. memory.
Data bus is bidirectional Address bus is unidirectional
Q68: What is the flag register name and its size in 8051?
Ans: Flag register in 8051 is called the program status word
(PSW) It is an 8-bit Register.
Q69: Which pins of 8051 is used as VCC and GND?
Ans: The pin 40 is used for VCC and Pin 20 is used for GND.
By ANAS 29 WWW.DAENOTES1.COM
Q70: Which ports are bit-addressable of 8051?
Ans: All (four) ports of 8051 (P0, P1, P2, P3) are bit
addressable.
Q71: Which pins are used for reset in 8051?
Ans: The pin 9 is used for reset function in 8051?
Q72: What is the frequency of crystal oscillator in 8051?
Ans: The frequency of the crystal oscillator in 8051 is 12
MHZ.
Q73: What is the size of TMOD and TCON Registers?
Ans: TMOD and TCON both are 8 bits Registers.
Q74: Which port of 8051 has no alternate function except
I/O?
By ANAS 30 WWW.DAENOTES1.COM
Ans: The P1 port of 8051 has no alternate function except
I/O.
Q75: What is the function of TMOD register?
Ans: TMOD stands for Timer Mode Control. It is a special
function register. TMOD is an 8 bit register by which the
modes of timers T0 and T1 are controlled.
Q76: What is the function of TCON register?
Ans: TCON stands for Timer Control Register. It is an 8-bit
special function register which is used to control the function
of timers and counters. Its upper bits are for timers and
counters while the lower 4 bits are for interrupts.
Q77: Which pins are used for RXD and TXD in port P3?
Ans: Pin 10 is used for RXD and Pin 11 is used for TXD in port
P3.
By ANAS 31 WWW.DAENOTES1.COM
❖ Chapter#3 Instruction Set
By ANAS 32 WWW.DAENOTES1.COM
Microcontroller instruction set can have up to
28 = 256 Instructions.
Q5: Define Arithmetic instruction?
Ans: Arithmetic instructions are the instructions given to the
8051 Microcontroller to perform various arithmetic
operations like addition and subtraction etc.
For example;
(i) SUB A, B (ii) ADD A, B
Q6: Write two arithmetic instructions?
Ans:
1) ADD A, RN
2) SUBB A, RN
Q7: Write types of Micro-controller according to instruction
set?
Ans:
1) CISC (Complex Instruction Set Computing).
2) RISC (Reduced instruction set computer).
3) SISC (Standard Instruction Set Computing).
Q8: Define CISC or CISC architecture microcontroller?
Ans: CISC stands for Complex Instruction Set Computing and
is pronounced: “sisk”. CISC is a type of processor design that
includes a large set of computer instructions in its built-in
instruction set. CISC instructions can vary in length, from
simple tasks to multi-step operations, with longer tasks
taking several clock cycles.
By ANAS 33 WWW.DAENOTES1.COM
The x86 processor architecture, which includes processors
made by Intel and AMD, is the most widely-used type of CISC
processor.
Q9: Describe advantages of CISC?
Ans:
1) Microprogramming requires assembly language that is
easier to implement. It is also less expensive than hard-
wiring a control unit.
2) Chip designers can make CISC processors upward
compatible because of the ease in micro-coding new
instructions.
3) The architecture reduces the amount of work that the
compilers have to do because the instructions are already
high-level.
4) It can utilize fewer instructions to implement a given task
since the execution of a single instruction will also execute
and complete several low-level tasks.
5) Access to memory is also flexible because of the complex
addressing mode. CISC instructions can directly access
memory locations.
6) Furthermore, the depth of details of the instructions
requires less memory. The CPU does most of the work
while decoding instructions.
7) The architecture uses general-purpose hardware to carry
commands. The structure of the instruction set does not
need to be changed when adding new commands.
Q10: Define RISC Microcontroller Architecture?
By ANAS 34 WWW.DAENOTES1.COM
Ans: RISC stands for Reduced Instruction Set Computer. A
Reduced Instruction Set Computer is a type of
microprocessor architecture that utilizes a small, highly-
optimized set of instructions rather than the highly-
specialized set of instructions typically found in other
architectures. RISC is an alternative to the Complex
Instruction Set Computing (CISC) architecture and is often
considered the most efficient CPU architecture technology
available today.
Q11: Describe advantages of RISC?
Ans:
1) Simple design.
2) Smaller size.
3) Less Power usage.
4) RISC requires fewer instruction formats, a lesser number of
instructions, and fewer addressing modes.
5) The required number of transistors is lesser because the
decoding logic is simple.
6) Fewer transistors mean that more general-purpose
registers and hardware can be fitted into the CPU or
chipset.
Q12: Describe Dis-advantages of RISC?
Ans:
1) A notable drawback of RISC architecture is that the
performance of the processor depends on the programmer
or software developer.
By ANAS 35 WWW.DAENOTES1.COM
2) Rearranging a CISC code to a RISC code increases the code
size. The quality of this code will depend on the compiler
and instruction set of the machine.
3) From the standpoint of developers, developing programs
for this architecture requires more effort when compared
to developing for CISC.
4) The simplicity of a processor based on a reduced
instruction set computer puts a lot of stress on the
software or application.
Q13: Difference between CISC and RISC?
Ans:
By ANAS 36 WWW.DAENOTES1.COM
Ans: As a typical 8-bit processor, the 8051 Microcontroller
instructions have 8-bit Opcodes. As a result, the 8051
Microcontroller instruction set can have up to
28 = 256 Instructions.
❖ Types of instructions
Depending on operation they perform, all instructions are
divided in several groups:
1) Arithmetic Instructions
2) Branch Instructions
3) Data Transfer Instructions
4) Logic Instructions
5) Bit-oriented Instructions
Q15: Define addressing mode of 8051 and their types?
Ans: An Addressing Mode is a way to locate a target Data,
which is also called as Operand. The 8051 Family of
Microcontrollers allows five types of Addressing Modes for
addressing the Operands. They are:
❖ Immediate Addressing
❖ Register Addressing
❖ Direct Addressing
❖ Register – Indirect Addressing
❖ Indexed Addressing
Q16: Define data transfer instruction?
Ans: Data transfer instructions move the content of one
register to another. The Mnemonics associated with Data
Transfer are given below.
By ANAS 37 WWW.DAENOTES1.COM
• MOV • POP
• MOVC • XCH
• MOVX • XCHD
• PUSH
Mnemonic Description
By ANAS 38 WWW.DAENOTES1.COM
3) PUSH Direct. 5) XCH Rn.
4) POP Direct.
By ANAS 39 WWW.DAENOTES1.COM
1) Unconditional jump instructions: upon their execution a
jump to a new location from where the program continues
execution is executed.
2) Conditional jump instructions: a jump to a new program
location is executed only if a specified condition is met.
Otherwise, the program normally proceeds with the next
instruction
Q22: Write two syntax of branch instructions?
Ans:
• ACALL addr11
Absolute subroutine call
• LCALL addr16
Long subroutine call
• RET
Returns from subroutine
• RETI
Returns from interrupt subroutine
• NOP
No operation
Q23: What is the function of XCH Instruction?
Ans: The XCH instruction loads the accumulator with the byte
value of the specified operand while simultaneously storing
the previous contents of the accumulator in the specified
operand.
Q24: What is the function of DIV Instruction?
By ANAS 40 WWW.DAENOTES1.COM
Ans: DIV is an arithmetic instruction which means Division.
For example; In register A on the DIV AB instruction. The data
in register B will be divided with the data in register B.
Q25: CJNE stands for?
Ans: CJNE Stands for Compare and jump if not equal. It
compares the magnitude of the destination byte and source
byte.
Q26: What is the function of CPL A instructions?
Ans: The function of CPL A instruction is used to
Complements the accumulator. In accumulator all the 1s
change with 0s and 0s changed with 1s (1=0, 0=1).
Q27: What is the difference between LJMP and SJMP?
Ans: SJMP stands for Short Jump. It can jump within a page of
256 bytes. LJMP refers to Long Jump. It can jump to any
location of 64KB memory.
Q28: What is the function of MOVX instruction?
Ans: The MOVX instruction transfers data between the
accumulator and external data memory.
Q29: Define AND CX, DX instruction?
Ans:
1) CX (Count register)
This is Count register. It is of 16 bits and is divided into two 8-
bit registers CH and CL to also perform 8-bit instructions.
2) DX (Data Register)
By ANAS 41 WWW.DAENOTES1.COM
This is data register. It is of 16 bits and is divided into two 8-
bit registers DH and DL to also perform 8-bit instructions.
Data register can be used as a port number in I/O operations.
It is also used in multiplication and division.
3) AX (Accumulator)
This is accumulator register. It is of 16 bits and is divided into
two 8-bit registers AH and AL to also perform 8-bit
instructions. It is used in arithmetic, logic and data transfer
instructions in 8086 microprocessors. In manipulation and
division, one of the numbers involved must be in AX or AL.
Q30: DJNZ Stands for what?
Ans: DJNZ Stands for Decrement Register and Jump if Not
Zero.
Q31: What’s the difference between ACALL and LCALL?
Ans: ACALL is an absolute subroutine call while LCALL is a
long subroutine call instruction. Subroutine address must be
kept within 2K bytes for ACALL and within 64K bytes for
LCALL.
Q32: What’s the difference between AJMP and LJMP?
Ans: AJMP is an absolute jump while LJMP is a long jump.
Q33: Compare AJMP, SJMP and LJMP instruction of 8051?
Ans: The differences are as follows;
By ANAS 42 WWW.DAENOTES1.COM
SJMP LJMP AJMP
Short jump, relative address is 8 bit it Long jump range is 64 Absolute jump to anywhere within 2k
support 127 location forward kb block of program memory
Conditional branch instruction can Cannot use long JMP Cannot the JMP absolute
use,relative JMP.
By ANAS 43 WWW.DAENOTES1.COM
2) CLR: This instruction clears a single bit to 0. The syntax
for CLR is "CLR bit," where "bit" specifies the bit to be
cleared. For example, the instruction "CLR A.7" clears bit
7 of the accumulator register A to 0.
Other single-bit instructions in the 8051 include CPL
(complement), ANL (bitwise AND), ORL (bitwise OR), and
XRL (bitwise exclusive OR). These instructions operate on a
single bit of a register or memory location while leaving
the other bits unchanged.
By ANAS 44 WWW.DAENOTES1.COM
Ans: Following points are important to know about
interfacing external memory with Micro-controllers;
• Type of external memory
• Capacity
• Organization
• Speed etc.
Q3: What is meant by memory organization?
Ans: The number of memory locations and the bit capacity of
the locations in memory is called memory organization.
Q4: What does memory capacity depend on?
Ans: The memory capacity of a device depends on many
factors such as the number of available address registers /
lines in the CPU.
In the case of 32-bit CPUs, they can only address a memory
capacity of up to 4 GB. As for a 64-bit computer, the memory
capacity is unlimited. Operating systems also influence
memory capacity.
Q5: What is the relationship between memory access time
and speed?
Ans: Both are inversely proportional to each other.
Q6: Write basic types of memory?
Ans:
The Basic Types of memory are as follow
1) Semi-conductor Memories
2) Magnetic Memories
By ANAS 45 WWW.DAENOTES1.COM
Q7: Write Types Of RAM?
Ans:
1) DRAM (Dynamic Random Access Memory).
2) SRAM (Static Random Access Memory).
3) NV RAM (Non-Volatile Random Access Memory).
Q8: Define Flash Memory?
Ans: Flash memory is an electronic non-volatile and Long-life
storage chip that is widely used in computer memory storage
medium. It has the ability to be electronically reprogrammed
and erased. The two main types of flash memory, NOR flash
and NAND flash, are named for the NOR and NAND logic
gates. Both use the same cell design, consisting of floating
gate MOSFETs.
It is often found in USB flash drives, MP3 players, digital
cameras and solid-state drives.
By ANAS 46 WWW.DAENOTES1.COM
Ans: Mask ROM is a read-only memory whose contents are
programmed by the integrated circuit manufacturer (rather
than by the user). The desired memory contents are
furnished by the customer to the device manufacturer.
By ANAS 47 WWW.DAENOTES1.COM
Q11: Define Program memory of micro-controller?
Ans: The memory in which the programs of microcontrollers
are stored is called program memory. Program memory
stores long-term information about the instructions that the
CPU carries out. Program memory is non-volatile memory,
meaning it holds information over time without needing a
power source.
Q12: Define Data Memory and Data Ram?
Ans: A type of memory which is used to store’s the data of
microcontroller is called data memory. 128Kb ram of 8051 is
called its data ram.
Q13: Define Address De-coding?
By ANAS 48 WWW.DAENOTES1.COM
Ans: Address decoding refers to accessing the desired
memory location by decoding the address code provided by
the processor.
Q14: Explain the methods of decoding the memory address?
Ans: Address decoding is done using
1) logic gates.
2) programmable logic devices.
Q15: Why is there a need for external memory interfacing
with microcontrollers?
Ans: Some micro-controllers such as 8031 do not have on-
chip RAM or sometimes the on-chip RAM is insufficient,
that’s why external memory is required in these situations.
Q16: Which instruction is used to transfer data to external
data ram in 8051?
Ans: MNOV X @DPTR, A
By ANAS 49 WWW.DAENOTES1.COM
Q2: Name the four Addressing modes of 8051
microcontroller?
Ans:
1) Immediate Addressing Mode.
2) Register Addressing Mode.
3) Direct Addressing Mode.
4) Register Indirect Addressing Mode.
5) Indexed Addressing Mode.
6) Implied Addressing Mode.
Q3: How many addressing modes are there in 8051?
Ans: In 8051 There are six types of addressing modes.
1) Immediate Addressing Mode.
2) Register Addressing Mode.
3) Direct Addressing Mode.
4) Register Indirect Addressing Mode.
5) Indexed Addressing Mode.
6) Implied Addressing Mode.
Q4: Define register address mode?
Ans: When data is transferred from a register to an
accumulator or from an accumulator to a register, it is called
register addressing mode.
In the register addressing mode the source or destination
data should be present in a register (R0 to R7). These are
some examples of RegisterAddressing Mode.
❖ Examples:
1) MOVA, R5.
By ANAS 50 WWW.DAENOTES1.COM
2) MOVR2, #45H.
3) MOVR0, A.
Q5: Define Immediate Addressing Mode?
Ans: In this Immediate Addressing Mode, the data is
provided in the instruction itself. The data is provided
immediately after the opcode. These are some examples of
Immediate Addressing Mode.
❖ Examples:
1) MOVA, #0AFH.
2) MOVR3, #45H.
3) MOVDPTR, #FE00H.
Q6: Define direct addressing mode?
Ans: In the Direct Addressing Mode, the source or
destination address is specified by using 8-bit data in the
instruction. Only the internal data memory can be used in
this mode. Here some of the examples of direct Addressing
Mode.
❖ Examples:
1) MOV80H, R6.
2) MOVR2, 45H.
3) MOVR0, 05H.
Q7: Define Register Indirect Addressing Mode?
Ans: In this mode we use register as a data pointer, the
source or destination address is given in the register. By using
register indirect addressing mode, the internal or external
addresses can be accessed. The R0 and R1 are used for 8-bit
By ANAS 51 WWW.DAENOTES1.COM
addresses, and DPTR is used for 16-bit addresses, no other
registers can be used for addressing purposes. Let us see
some examples of this mode.
❖ Examples:
1) MOV0E5H, @R0.
2) MOV@R1, 80H.
Q8: Write merits of Register Indirect Addressing Mode?
Ans:
1) Looping is possible in Register Indirect Addressing Mode,
while Looping is not possible in Direct Addressing Mode.
2) Register indirect addressing mode is useful if a series of
data is to be assigned to that address, with the help of this
quality the number of instructions decreases as a result of
which performance increases.
Q9: Write limitations of register indirect addressing mode?
Ans: As mentioned earlier, only registers R0 and R1 can be
used in register indirect addressing mode, while both of them
have a capacity of 8 bits, So its use is limited to only the
internal RAM of the microcontroller. To access data when in
external RAM or on-chip ROM we need a 16-bit pointer. In
these Situations, the DPTR register is used.
Q10: Define Indexed Addressing Mode?
Ans: In the indexed addressing mode, the source memory
can only be accessed from program memory only. The
destination operand is always the register A. These are some
examples of Indexed addressing mode.
By ANAS 52 WWW.DAENOTES1.COM
❖ Examples:
1) MOVCA, @A+PC;
2) MOVCA, @A+DPTR;
Q11: Define Look-up table and MOVC instruction?
Ans:
❖ MOVC instruction:
The MOVC instruction moves a byte from the code or
program memory to the accumulator.
❖ Look-Up Table:
The look-up table is a very widely used concept in
microprocessor programming. It allows access to frequently
used tables and payments with minimal operation
requirements.
For example, suppose for a particular application we need
values of X2 in the range 0 to 9. Instead of finding all the
values through calculations, this can be done more easily
with a look-up table.
❖ For example;
By ANAS 53 WWW.DAENOTES1.COM
Q12: Define MOVX instruction?
Ans: The MOVX instruction transfers data between the
accumulator and external data memory. External memory
may be addressed via 16-bits in the DPTR register or via 8-
bits in the R0 or R1 registers. When using 8-bit addressing,
Port 2 must contain the high-order byte of the address.
Q13: Define addressing of RAM location OR define memory
addressing?
Ans: A memory address is an exact assigned location in RAM
used to track where information is stored. On a single
computer memory IC, there can be 1 million, 2 million, or
more memory addresses that can be accessed at randomly,
which is why memory is called RAM (random access
memory).
Q14: Define Bit address?
Ans: A main storage address is an index into memory. A 32-
bit address is the address of a single byte. Thirty-two wires
of the bus contain an address (there are many more bus
wires for timing and control). Sometimes people talk about
addresses like 0x2000, which looks like a pattern of just 16
bits.
By ANAS 54 WWW.DAENOTES1.COM
Q15: Write uses of addressing mode in programming?
Ans: Data is stored in different places in a microcontroller.
During programming, the programmer frequently needs this
data, which consists of look-up tables and instructions. So the
programmer accesses this data using different addressing
modes.
Q16: Which addressing mode is used to access the stack?
Ans: Direct addressing mode is used for the access of stack.
Q17: Write two instructions in Indirect addressing mode?
Ans:
1) MOV A, @ R1
2) MOV A @ RO
Q18: What is the advantage of indirect addressing mode
over direct addressing?
Ans: The Indirect Addressing mode makes data access
dynamic. In direct addressing mode the instruction has to be
halted repeatedly whereas Indirect addressing mode this is
not the case.
By ANAS 55 WWW.DAENOTES1.COM
Ans: A programming language in which instructions and
storage locations are represented by letters and symbols,
called assembly language.
OR
An assembly language is a type of low-level programming
language that is intended to communicate directly with a
computer's hardware.
Q2: Assembly language, which type of programming
language?
Ans: An assembly language is a type of low-level
programming language that is intended to communicate
directly with a computer's hardware.
Q3: What is meant by natural language?
Ans: The language we speak like Urdu, English etc. is called
natural language.
Q4: What is meant by the syntax rules of a language? Or
define machine language.
Ans: The standard rules for using the words and symbols of a
language are called the syntax rules of that language.
Q5: Define Machine language?
Ans: A type of language in which instructions are written in
binary form is called machine language. Machine language
is the language understood by a computer. It is very difficult
to understand, but it is the only thing that the computer can
work with. All programs and programming languages
eventually generate or run programs in machine language.
By ANAS 56 WWW.DAENOTES1.COM
Q6: Define Assembly Language?
Ans: Assembly language is second-generation language. It is
close to machine language. It is one step higher than machine
language. The programs in assembly language are written by
using short names known as mnemonics. It is pronounced as
Ne-Monics.
By ANAS 57 WWW.DAENOTES1.COM
Ans: In computing, an opcode (abbreviated from operation
code, also known as instruction machine code, instruction
code, instruction syllable, instruction parcel or opstring)
is the portion of a machine language instruction that specifies
the operation to be performed.
Q8: Define operand/program data?
Ans: The part of assembly language that tells a computer
what function to perform is called Opcode or program data.
Q9: What are the syntax rules of assembly language?
Ans:
1) Each line of a program can contain a maximum of 255
characters.
2) A symbol, label, nickname, or directory must be unique at
the beginning of each line of the programmer.
3) If any text in a program line is preceded by a ' ; ' symbol,
the assembler treats it as a comment and ignores it.
4) There must be at least one character space between all
components of a program instruction.
Q10: What is meant by Operand?
Ans: The part of the instruction that specifies the data
storage location is called the operand.
Q11: Write the types of programming language?
Ans: There are two types of programming languages,
1) Low Level Languages
2) High Level Languages
By ANAS 58 WWW.DAENOTES1.COM
Q12: Define High Level Language?
Ans: A type of language that is close to human languages is
called high-level language. These languages are machine-
independent and are also called third-generation languages.
They consist of English words, basic mathematical symbols
and some punctuation characters. These languages are easy
to understand.
The programs written in high-level language are not directly
understood by computer. programs are translated into
machine code by a translator. Each high-level language has
its own language translator. Some examples of high-level
languages are C, C++, BASIC, FORTRAN and Java etc.
Q13: Write names of four high-level languages and also
write the names of low-level languages?
Ans:
High-level languages
C, BASIC, FORTRAN, COBOL, Java etc.
Low-level Languages
Machine Language, Assembly language.
Q14: Write basic components of assembly language?
Ans:
• Label • Operand
• Mnemonics • Comments
Q15: Define Label field?
By ANAS 59 WWW.DAENOTES1.COM
Ans: A label field refers to an address that is not known when
writing the instruction. It always has a colon (:) at the end.
This always at the beginning of the program line.
Q16: Define Mnemonics field?
Ans: The mnemonic field identifies whether a statement is an
instruction statement or a pseudo-op statement. Each
mnemonic requires a certain number of operands in a certain
format. For an instruction statement, the mnemonic field
contains an abbreviation like ai (Add Immediate) or sf
(Subtract From).
Q17: State the drawback of not using labels?
Ans: Not using labels makes it difficult to call subroutines,
execution of jump and branch instructions.
Q18: Define Operand field?
Ans: Operand Field specifies either the address or the data
Q19: Define Comment Field?
Ans: That part of the instruction which is not mandatory/
compulsory but is important enough for the programmer is
called comment field. Comments are always begins with the
Semicolon (;).
Q20: Write the names of two types of BCD code?
Ans:
1. Packed BCD 2. Unpacked BCD
Q21: Define BCD/8421 code?
By ANAS 60 WWW.DAENOTES1.COM
Ans: BCD stands for binary coded decimal. It is used to
represent decimal digits in binary. It is a 4bit code, It means
that each decimal digit is represent by 4 binary digits. It was
used by early computers.
The BCD is a weighted code and the weights used in binary
coded decimal code are 8, 4, 2, 1, commonly called the 8421
code as it forms the 4-bit binary representation of the
relevant decimal digit.
By ANAS 61 WWW.DAENOTES1.COM
This scheme allows 4 digits to be packed into a 16 bit word,
or 8 digits into a 32 bit word, as shown below.
Q23: Define Unpacked BCD?
Ans: The term unpacked BCD usually implies a full byte for
each digit (often including a sign).
Q24: Define Symbols?
Ans: Symbols used to represent registers, subroutines,
contents and addresses etc. in assembly language are called
symbols.
Q25: Define Operator?
Ans: The symbols used to represent arithmetic and logical
operations in assembly language are called operators.
Q26: Define Assembler?
Ans: An assembler is a translating program that translates
the instruction of assembly language into machine language.
Q27: What is meant by Assembler directives?
Ans: The set of instructions provided by the programmer to
make the assembler work correctly is called assembler
directives.
Q28: Name four Assembler directives?
Ans:
1) Bit directive. 4) Set directive.
2) Org directive. 5) EQU directive.
3) Data directive. 6) Code directive.
By ANAS 62 WWW.DAENOTES1.COM
Q1: Define Syntax?
Ans: A set of rules for writing program in programming
language is known as syntax.
Q2: UART stands for and define it?
Ans: UART stands for universal asynchronous receiver-
transmitter. UART is one of the most used device-to-device
communication protocols.
By ANAS 63 WWW.DAENOTES1.COM
Ans: USART stands for universal synchronous/asynchronous
receiver/transmitter. USART is an IC chip in which RS232
protocol used.
OR
USART is a hardware that enables a device to communicate
using serial protocols. It can function in a slower
asynchronous mode, like a universal asynchronous
receiver/transmitter (UART), or in a faster synchronous mode
with a clock signal.
Q4: Write applications of addressing mode in programming
language?
Ans: The term addressing modes refers to the way in which
the operand of an instruction is specified. The addressing
mode specifies a rule for interpreting or modifying the
address field of the instruction before the operand is actually
executed.
Addressing modes for 8086 instructions are divided
into two categories:
1) Addressing modes for data
2) Addressing modes for branch
Q5: Define Serial port register?
Ans: A serial port register is a 8bit shift register that allows to
transmit or receive data at a time. It is one of the oldest
types of interfaces and at one time was commonly used to
connect printers and external modems to a PC.
Q6: Define data structure?
By ANAS 64 WWW.DAENOTES1.COM
Ans: In computer science, a data structure is a data
organization, management, and storage format that is usually
chosen for efficient access to data
Q7: Define peripheral support chip and its function?
Ans: A chip containing various controllers and electronics
components on the motherboard of a microprocessor that
interacts with the CPU, memory and various peripheral
devices. A peripheral support is called a chip. Its function is to
provide synchronization and coordination between
peripheral devices with different data structures and speeds
and the
Q8: Define Loop structure?
Ans: Loop structure is a structure in a program that allows us
to run one or more lines of code/instructions repetitively.
Q9: Define Timer function register?
Ans: A timer is a specialized type of clock which is used to
measure time intervals.
Q10: What is capture mode?
Ans: "Capture" mode saves the current timer value into the
CCP registers when a specific event occurs.
Q11: Define peripheral device?
Ans: A peripheral device is an internal or external device that
connects directly to a computer or other digital device but
does not contribute to the computer's primary function, such
as computing. It helps end users access and use the
functionalities of a computer.
By ANAS 65 WWW.DAENOTES1.COM
Examples,
• Mouse. • Scanner.
• Keyboard. • Speakers.
• Printer. • External Drive.
• Monitor. • USB Flash Drive.
• Webcam. • CD-ROM.
• Printer.
Q12: Write down the types of peripheral devices?
Ans: Peripherals are commonly divided into three
kinds: input devices, output devices, and storage devices.
Q13: Define ADC?
Ans: ADC stands for Analog to Digital Converter. In
electronics, an analog-to-digital converter is a system that
converts an analog signal, such as a sound picked up by a
microphone or light entering a digital camera, into a digital
signal.
Q14: Write advantages and dis-advantages of LM35?
Ans:
Advantages
1) large temperature coefficient of resistance,
2) high sensitivity,
3) small heat capacity,
4) fast response;
Disadvantages
By ANAS 66 WWW.DAENOTES1.COM
1) it requires a negative bias voltage to measure negative
temperature.
2) poor interchangeability and non-linearity of
thermoelectric characteristics which is to expand the
measurement.
Q15: Define LM35?
Ans: LM35 is a temperature measuring device having an
analog output voltage proportional to the temperature. It
provides output voltage in Centigrade (Celsius). It does not
require any external calibration circuitry. The sensitivity of
LM35 is 10 mV/degree Celsius.
By ANAS 67 WWW.DAENOTES1.COM
Ans: In order to operate a Microcontroller, it is necessary to
use appropriate input and output devices with it. While the
electrical properties of these devices are not the same.
Hence appropriate interface devices are used with them.
Q18: Difference between instructions and directives?
Ans: An instruction is directly translated to something the
CPU can execute. A directive is something the assembler can
interpret, and tells something about the way the instructions
are to be assembled. Directives are never something the CPU
will see.
Q19: What is the purpose of program counter?
Ans: The program counter, PC, is a special-purpose register
that is used by the processor to hold the address of the next
instruction to be executed.
Q20: Name two features of 8051?
Ans:
1) 4KB bytes on-chip program memory (ROM)
2) 128 bytes on-chip data memory (RAM)
3) Four register banks
4) 128 user defined software flags
5) 8-bit bidirectional data bus
6) 16-bit unidirectional address bus
7) 32 general purpose registers each of 8-bit
8) 16 bit Timers (usually 2, but may have more or less)
By ANAS 68 WWW.DAENOTES1.COM
9) Three internal and two external Interrupts
10) Four 8-bit ports,(short model have two 8-bit ports)
11) 16-bit program counter and data pointer
12) 8051 may also have a number of special features such as
UARTs, ADC, Op-amp, etc.
Q21: Can the programmer of microcontroller make up new
addressing modes?
Ans: ‘NO’ the programmer of microcontroller cannot make
up new addressing modes.
Q22: How many Timers in 8051?
Ans: The 8051 has two timers, Timer 0 and Timer 1. They can
be used as timers or as event counters.
Q23: What is the largest hex value that can be moved into
an 8-bit register?
Ans: The largest hexadecimal value that can be moved into
an 8-bit register is FFH or 255 in decimal.
Q24: Define Interrupt service routine?
Ans: An interrupt service routine (ISR) is a special type of
software routine that is designed to handle interrupts
generated by a computer system. When an interrupt occurs,
the processor interrupts the current execution of the
program and transfers control to the ISR. The ISR then
performs a specific task or set of tasks, such as updating a
variable, responding to user input, or communicating with a
peripheral device. ISRs are commonly used in
By ANAS 69 WWW.DAENOTES1.COM
microcontroller-based systems, where they are used to
handle interrupts generated by external events such as
button presses, sensor readings, or timer overflows.
Q25: Including reset how many interrupts does the 8051
have?
Ans: The 8051 microcontroller has a total of five interrupts,
including the reset interrupt. The five interrupts are:
1) Reset interrupt: This is the highest priority interrupt and
occurs when the microcontroller is first powered on or
when the reset pin is activated. The reset interrupt
initializes the microcontroller and sets the program
counter to the reset vector address.
2) External interrupt 0: This interrupt is generated by an
external signal applied to the INT0 pin of the
microcontroller. It can be configured to trigger on either a
rising edge, falling edge, or a level change of the external
signal.
3) External interrupt 1: This interrupt is generated by an
external signal applied to the INT1 pin of the
microcontroller. It can also be configured to trigger on
either a rising edge, falling edge, or a level change of the
external signal.
4) Timer 0 interrupt: This interrupt is generated when the
Timer 0 register overflows. The Timer 0 can be used for
generating precise delays and can be configured in
different modes such as 16-bit timer, 13-bit timer, and 8-
bit auto-reload timer.
By ANAS 70 WWW.DAENOTES1.COM
5) Timer 1 interrupt: This interrupt is generated when the
Timer 1 register overflows. The Timer 1 can also be used
for generating precise delays and can be configured in
different modes such as 16-bit timer, 13-bit timer, and 8-
bit auto-reload timer.
Each interrupt has a specific priority level, with the reset
interrupt having the highest priority and the Timer 1
interrupt having the lowest priority. The priority of the
interrupts can be modified by configuring the interrupt
enable (IE) register and the interrupt priority (IP) register.
Q26: What is the difference between serial and parallel
communication?
Ans: Serial and parallel communication are two methods
used for transmitting data between electronic devices.
Serial communication involves transmitting data one bit
at a time, usually over a single wire or channel. In serial
communication, the bits are transmitted in a sequential
manner, with each bit following the previous one. The
advantage of serial communication is that it requires
fewer wires or channels and can transmit data over
longer distances. However, the speed of data
transmission is slower than parallel communication.
By ANAS 71 WWW.DAENOTES1.COM
parallel communication is that it can transmit data
faster than serial communication. However, parallel
communication requires more wires or channels and is
more susceptible to noise interference.
In summary, the key differences between serial and parallel
communication are:
1) Number of wires or channels: Serial communication uses
fewer wires or channels than parallel communication.
2) Speed of data transmission: Parallel communication is
faster than serial communication.
3) Distance of data transmission: Serial communication can
transmit data over longer distances than parallel
communication.
4) Susceptibility to noise interference: Parallel
communication is more susceptible to noise interference
than serial communication.
Q27: What are the advantages of indirect addressing mode
over direct addressing mode?
Ans: In a microcontroller, indirect addressing mode refers to
accessing memory or registers through a pointer, while direct
addressing mode refers to accessing memory or registers
directly. Here are some advantages of using indirect
addressing mode over direct addressing mode:
1) Flexibility: Indirect addressing mode provides greater
flexibility than direct addressing mode because it allows
you to access memory locations or registers that may not
By ANAS 72 WWW.DAENOTES1.COM
be known at the time the program is written. For example,
you can use indirect addressing mode to access memory
locations that are calculated at runtime based on input
from a sensor or user.
2) Efficient use of memory: Indirect addressing mode can be
used to optimize memory usage by storing multiple values
in a single memory location and using a pointer to access
them. This can be useful in situations where memory is
limited.
3) Code reusability: Indirect addressing mode allows you to
write code that is more reusable because it can be adapted
to work with different memory locations or registers. This
is especially useful when writing code for microcontrollers
with different memory architectures or when you need to
reuse code in multiple projects.
4) More concise code: Indirect addressing mode can
sometimes result in more concise code compared to direct
addressing mode, especially when working with complex
data structures such as arrays or linked lists.
5) Easier debugging: Indirect addressing mode can make
debugging easier because it allows you to isolate memory
access errors to a single pointer rather than having to
search for every occurrence of a specific memory address
in your code.
Q28: In P3 which pin are for RXD and TXD?
Ans: In the context of electronics or microcontrollers, "P3" is
likely referring to Port 3 on an 8051 microcontroller. The pin
By ANAS 73 WWW.DAENOTES1.COM
assignments for RXD (receive data) and TXD (transmit data)
can vary depending on the specific microcontroller and the
hardware design.
However, commonly, on an 8051 microcontroller, the RXD
pin is assigned to P3.0 (pin 1) and the TXD pin is assigned to
P3.1 (pin 2).
By ANAS 74 WWW.DAENOTES1.COM
Here, A is the accumulator, which is used as the first
operand, and the second operand can be a register or a
memory location. For example, the instruction "ORL A, 0x0F"
performs a bitwise logical OR between the contents of the
accumulator and 0x0F, and stores the result in the
accumulator.
Q30: What is the value of the (PC) program counter when
the 8051 is powered up?
Ans: when the 8051 is powered up, the PC (program counter)
has the value of 0000 in it.
Q31: Define FOR Loop?
Ans: A for loop is a control flow statement used in computer
programming that allows a developer to execute a block of
code repeatedly for a fixed number of times or until a specific
condition is met. The loop consists of three parts:
1. Initialization: setting a variable to an initial value.
2. Condition: defining the condition that must be true for
the loop to continue.
3. Increment/Decrement: modifying the value of the
variable in each iteration of the loop.
The syntax of a for loop in most programming languages is:
for(initialization; condition; increment/decrement)
{ //code block to be executed }
Q32: Define Memory address decoding?
By ANAS 75 WWW.DAENOTES1.COM
Ans: Memory address decoding is the process of translating a
memory address generated by a computer's CPU into a
physical memory location in the computer's memory. When
the CPU generates an address to access data in memory, it
sends the address to the memory controller, which uses a
memory address decoder to determine which physical
memory location corresponds to the requested address
Q33: Define Editor?
Ans: An editor can refer to different things depending on the
context, but generally, it is a person or a tool that is
responsible for reviewing, revising, and improving written or
multimedia content.
In the context of writing, an editor can be a professional who
is hired to help authors or publishers improve their work.
They can provide feedback on aspects such as clarity,
structure, grammar, punctuation, and style, and suggest
revisions to make the text more effective and engaging.
In the context of multimedia content, an editor can be a
software tool used to manipulate and refine audio, video, or
image files. This can involve tasks such as cutting, trimming,
merging, adding effects, color grading, and more, depending
on the medium being edited.
Q34: What is meant by program development tools?
Ans: The software programs used in program development of
microcontroller are called program development tools. These
tools assist programmers in writing code, debugging errors,
testing programs, and managing code repositories.
By ANAS 76 WWW.DAENOTES1.COM
There are many different types of program development
tools available, including integrated development
environments (IDEs), text editors, version control systems,
compilers, and debuggers.
Q35: Define Subroutine?
Ans: Subroutine is a set of instructions that can be used from
anywhere in the program by calling it. When a subroutine is
called, the control is transferred to a specific line number and
executes all instructions in the subroutine. Then the control
returns to the line number from where the subroutine was
called.
Subroutine can be written anywhere in the program but it is
normally written at the end of program. The process of
writing subroutine is easier than writing function. However,
subroutine is not given any name. The subroutine is called by
referring to the line number of its first statement. GOSUB
statement is used to call a subroutine.
Q36: Define LOOP?
Ans: A statement or a set of statements that is executed
repeatedly is called loop.
TYPES
1) FOR…NEXT loop
2) WHILE…WEND loop
Q37: Define FOR…NEXT loop / for loop?
Ans: FOR…NEXT loop is used to execute a statement or a set
of statements for a specified number of times. This loop
By ANAS 77 WWW.DAENOTES1.COM
depends on the value of variable to repeat the statement.
This variable is called counter variable or control variable.
Q38: Define WHILE…WEND loop / while loop?
Ans: WHILE... WEND loop is the simplest loop of BASIC
language. It executes one or more statements while the given
condition remains true. The loop terminates when the
statement becomes false. It is useful when the number of
iterations is not known in advance.
By ANAS 78 WWW.DAENOTES1.COM
Q40: Define Interrupt priority?
Ans: Interrupt priority is a concept in computer systems and
microprocessors that determines the order in which
interrupts are handled by the system. When an interrupt
request (IRQ) is received, the system must determine which
interrupt has the highest priority and handle it first, before
handling lower-priority interrupts.
Interrupt priority is typically determined by the level of
urgency or importance of the interrupt, with higher-priority
interrupts having more urgent or critical tasks to perform
Q41: Why we need peripheral support chip?
Ans: Peripheral support chips, also known as peripheral
interface controllers (PICs), are used to provide additional
functionality and features to a computer system or
microcontroller-based device. These chips are designed to
interface with specific peripheral devices, such as sensors,
By ANAS 79 WWW.DAENOTES1.COM
actuators, or displays, and provide the necessary support and
control functions to enable the device to operate properly.
Q42: What is 5255A?
Ans: The 5255A is a type of frequency counter, which was
manufactured by Hewlett-Packard (now Keysight
Technologies) in the 1970s and 1980s. It is a highly accurate
instrument that is capable of measuring frequencies up to 18
GHz, with a resolution of 9 digits per second. The 5255A uses
a combination of time and frequency measurement
techniques to achieve its high accuracy.
By ANAS 80 WWW.DAENOTES1.COM
settings and parameters of a serial communication interface.
In particular, SCON is used in the Intel 8051 family of
microcontrollers, which are widely used in embedded
systems and other applications. The SCON register can be
accessed and modified by software running on the
microcontroller, allowing the serial communication interface
to be customized for specific applications.
In summary, SCON is a register used in some microcontrollers
and microprocessors, such as the Intel 8051, to control the
settings and parameters of a serial communication interface.
In short
The Serial Control or SCON SFR is used to control the 8051
Microcontroller's Serial Port.
By ANAS 81 WWW.DAENOTES1.COM
managing data traffic between these components and the
processor.
Q45: Define Ethernet?
Ans: Ethernet is a family of networking technologies used for
local area networks (LANs). It is a widely used protocol for
connecting computers and other devices together within a
local network. Ethernet networks can be wired or wireless,
and typically operate at speeds ranging from 10 Mbps to 100
Gbps. Ethernet was originally developed by Xerox
Corporation in the 1970s as a way to connect computers
within a single building or campus. Today, it is a global
standard maintained by the Institute of Electrical and
Electronics Engineers (IEEE), and is used in a wide range of
applications, from home networks to large enterprise
networks.
Q46: Define Transducer?
Ans: A transducer is an electronic device that converts
energy from one form to another. The process of converting
energy from one form to another is known as transduction.
By ANAS 82 WWW.DAENOTES1.COM
Ans: ADC, or Analog-to-Digital Converter, is a device that
converts analog signals into digital signals. Here are some of
the key properties of ADC:
1) Resolution: ADC resolution is the number of bits used to
represent the digital signal. Higher resolution ADCs can
provide more precise measurements and better accuracy.
2) Sampling rate: Sampling rate refers to the number of
samples taken per second. A higher sampling rate allows
for a more accurate representation of the analog signal.
3) Linearity: Linearity is the degree to which the ADC output
is proportional to the input analog signal. Non-linearities in
an ADC can cause errors in the output digital signal.
4) Accuracy: Accuracy refers to the degree to which the ADC
output represents the true input analog signal. This is
influenced by factors such as noise, linearity, and
calibration.
5) Input range: The input range of an ADC refers to the range
of analog signal values that can be converted to digital.
ADCs may have different input ranges, and some may be
more suited to specific applications.
6) Power consumption: Power consumption is an important
consideration in many applications, particularly for
battery-powered devices. ADCs can consume a significant
amount of power, and low-power ADCs may be preferred
in some cases.
7) Conversion time: The conversion time of an ADC refers to
the time it takes to convert an analog signal into a digital
By ANAS 83 WWW.DAENOTES1.COM
signal. Faster conversion times may be required for some
applications.
Overall, the properties of an ADC are important
considerations when selecting an ADC for a specific
application. The requirements for resolution, sampling rate,
linearity, accuracy, input range, power consumption, and
conversion time may vary depending on the application.
Q48: What is ADC 0804?
Ans: ADC0804 is an 8-bit analog-to-digital converter (ADC)
integrated circuit (IC) that is commonly used to convert
analog signals to digital signals in various electronic circuits.
The ADC0804 IC is manufactured by many semiconductor
companies and is widely used due to its low cost, ease of use,
and reliability. The ADC0804 IC features a single-ended input
with an input voltage range of 0 to 5 volts and an output data
format in binary straight binary. The input voltage is sampled
and converted to an 8-bit digital output using successive
approximation technique. The conversion time of the
ADC0804 IC is typically 100 microseconds, and it can convert
up to 50,000 samples per second.
Q49: Write down the clocking frequency of ADC 0804?
Ans: The ADC0804 is a relatively old and widely used 8-bit
analog-to-digital converter (ADC) integrated circuit (IC). The
clocking frequency of the ADC0804 depends on the
frequency of the clock input signal applied to its CLK pin. The
datasheet for the ADC0804 specifies that the clock frequency
should be between 100 kHz and 640 kHz for proper
By ANAS 84 WWW.DAENOTES1.COM
operation. The conversion time of the ADC0804 is typically
100 microseconds, which means that the maximum
conversion rate is approximately 10,000 samples per second
(or 50,000 samples per second if the maximum clock
frequency of 640 kHz is used). It's important to note that the
conversion rate can be affected by factors such as the input
voltage range, the resolution, and the external circuitry used
with the ADC0804.
Q50: Describe need of programming?
Ans: Programming is the process of creating software,
applications, and computer programs by writing code in a
programming language. Programming is necessary for a
variety of reasons, including:
1) Automation: Programming can automate repetitive and
time-consuming tasks, freeing up time for more important
work. For example, programming can be used to automate
data entry, generate reports, or perform calculations.
2) Problem-solving: Programming can be used to solve
complex problems that may be difficult or impossible to
solve using manual methods. For example, programming
can be used to create algorithms for data analysis, image
processing, or machine learning.
3) Creativity: Programming can be a creative pursuit, allowing
individuals to express their ideas and create innovative
software and applications. Programmers can create games,
art, music, and other interactive experiences using
programming.
By ANAS 85 WWW.DAENOTES1.COM
4) Efficiency: Programming can increase efficiency and
productivity in various industries by streamlining
workflows, reducing errors, and improving
communication. For example, programming can be used to
create inventory management systems, scheduling
software, or customer relationship management (CRM)
systems.
5) Accessibility: Programming can help make technology
more accessible to a wider range of people. For example,
programming can be used to create software for people
with disabilities or to develop assistive technologies that
make it easier for people to use computers and other
devices.
Overall, programming is an essential skill in today's world,
with applications in nearly every industry and field.
Programming allows individuals and organizations to solve
problems, create new opportunities, and improve the
efficiency and effectiveness of their work.
Q51: Define IE?
Ans: IE stands for Interrupt enable. Interrupt enable refers to
a mechanism in computer systems that allows interrupts,
such as hardware interrupts or software interrupts, to be
enabled or disabled. When interrupts are enabled, the
system is able to respond to external events or signals that
require attention, such as user input, disk I/O, or network
traffic. When interrupts are disabled, the system ignores such
signals and focuses on the current task it is executing.
Q52: Define Interrupt?
By ANAS 86 WWW.DAENOTES1.COM
Ans: An interrupt is a signal or event that temporarily halts
an ongoing process.
Q53: State the importance of enter or state the utility of
interrupt
Ans: During a process some events occur which needs to be
handled immediately. These are called interrupts. If they are
not handled at all times, there is a risk of damage. So, in
microcontrollers there’s a program which are not a part of
normal program, used. This is to give the microcontroller the
ability to handle interrupts.
Q54: Define Polling method in interrupts?
Ans: In polling method, the microcontroller scans the status
of all the peripheral devices sequentially and assigns the
desired service to the device.
Q55: Define PSW?
Ans: PSW stands for "Program Status Word," which is a term
used in computer architecture and programming. The PSW is
a register that is used to store information about the status
of a program, including program execution mode, processor
state, and error conditions. The contents of the PSW can be
modified by the processor during program execution.
Q56: Define Input Capture?
Ans: Input capture is a feature of many microcontrollers and
digital signal processing devices that allows the device to
capture the timing or frequency of an external event, such as
a signal or waveform. The input capture function is typically
By ANAS 87 WWW.DAENOTES1.COM
used in real-time applications, such as data acquisition, signal
processing, or control systems.
Input capture can be useful in a variety of applications, such
as measuring the speed of a motor or the frequency of a
signal, or detecting the occurrence of a specific event. The
accuracy and resolution of the input capture function depend
on the specific device and the settings used, such as the clock
source and input signal characteristics.
By ANAS 88 WWW.DAENOTES1.COM
The 8051 microcontroller is a popular 8-bit microcontroller
that was introduced by Intel in the 1980s. It has a Harvard
architecture and consists of the following blocks:
1. Central Processing Unit (CPU): The CPU of the 8051 is
an 8-bit processor that is responsible for executing
instructions and controlling the operation of the
microcontroller.
2. Random Access Memory (RAM): The 8051 has 128
bytes of internal RAM that can be used to store data and
program code. Additional external RAM can also be
added to the system.
3. Read Only Memory (ROM): The 8051 has 4KB of
internal ROM that contains the program code for the
By ANAS 89 WWW.DAENOTES1.COM
microcontroller. Additional external ROM can also be
added to the system.
4. Input/Output (I/O) ports: The 8051 has four 8-bit
input/output ports (P0, P1, P2, and P3) that can be used
to interface with external devices such as sensors,
actuators, or displays.
5. Timers and Counters: The 8051 has two 16-bit
timer/counters (T0 and T1) that can be used to generate
precise timing signals or count external events.
6. Serial Communication Interface (SCI): The 8051 has a
serial communication interface that supports both
synchronous and asynchronous communication modes.
This interface can be used to communicate with other
devices or systems.
7. Interrupt system: The 8051 has a flexible interrupt
system that allows external events or signals to
interrupt the normal program flow and execute specific
interrupt service routines.
These blocks and components work together to provide a
powerful and versatile microcontroller that can be used in a
wide range of applications. The 8051 microcontroller is
widely used in embedded systems, control systems, and
other applications where real-time processing and control
are required.
Q2: Explain differences between microcontroller and
microprocessor?
Ans:
By ANAS 90 WWW.DAENOTES1.COM
Parameter Microprocessor Microcontroller
By ANAS 91 WWW.DAENOTES1.COM
Q3: Discuss buses in microcontroller?
Ans: A microcontroller consists of different devices.
Microcontroller must be able to communicate with all
devices. The devices are connected together by a
communications channel called bus. A bus consists of a set of
communication lines or wires. These lines are used to move a
large amount of bits in the form of electrical pulses from one
unit to another.
TYPES:
• Data Bus
• Address Bus
• Control Bus
1) Data Bus
A type of bus through which the processor sends and
receives data to other parts of the microcontroller such as
RAM and ROM etc. is called a data bus. Sending and receiving
data indicates that it is a bi-directional bus. The more the
number of wires in the bus of any microcontroller, the higher
the speed of the microcontroller. A bus is defined in bits. An
8-bit bus can transfer one byte of data at a time. While two
bytes of data can be transferred through an 18-bit bus, as the
bus size increases, the cost of the microcontroller increases.
2) Address Bus
The processor addresses other devices such as memory
locations and other devices through the address bus. CPU
sends only address signals through this bus so it is a
By ANAS 92 WWW.DAENOTES1.COM
unidirectional bus. The memory size of any system depends
on the size of its address bus. A bit address can address more
memory locations than an 18-bit address bus.
3) Control Bus
In a microcontroller, the control bus is typically used to
transfer commands or instructions from the processor to
other devices, such as memory or input/output (I/O)
peripherals. The control bus carries signals that allow the
processor to specify the operation that the connected device
should perform, such as reading data from a memory
location or writing data to an output port.
Q4: Discuss different parts of flow chart?
Ans: Flowchart is combination of two words flow and chart. A
chart consists of different symbols to display information
about any program. Flowchart is a graphical representation
of an algorithm. It is used to represent Algorithm in diagram
form by various symbols.
1) Terminals
2) Input/Output
3) Processing
4) Subroutine
By ANAS 93 WWW.DAENOTES1.COM
5) Decision
6) Flow Lines
7) Connectors
1) Terminals
Oval is used to represent the start or end of the flow chart. It
is also called terminal.
Terminal
Terminal
2) Input/Output
Parallelogram is Used to represent an input or output step in
flowchart.
Input/Out
put
3) Processing
Rectangle is used to represent a processing or computational
operation in the flowchart.
4) Subroutine
By ANAS 94 WWW.DAENOTES1.COM
Subroutine refers to programs that are not part of the main
program but need again and again in the main program. It is
also represented by a rectangular symbol, but have an extra
line on both sides.
5) Decision
Diamond symbol is used to represent decision step in the
flowchart. The flow of control from diamond may go in two
possible directions. It goes to one direction if the condition is
TRUE or YES and to second direction if the condition is FALSE
or NO.
Diamond
6) Flow Lines
Arrows are used to represent the direction of flow in the
flowchart. There are four flow lines to represent four
directions.
By ANAS 95 WWW.DAENOTES1.COM
7) Connectors
Circle symbol is used to combine different flow lines. It is
used when two or more flow symbols come from different
directions and move to one direction.
Q5: Find the timers clock frequency and its time period for
8051 based system with the 16 MHz crystal frequency?
Ans: In an 8051 based system, the timers are driven by the
system clock, which is the same as the crystal frequency.
Therefore, the clock frequency for the timer in this case
would be 16 MHz.
To calculate the time period for the timer, we can use the
formula:
Time period = 1 / Clock frequency
Substituting the value of clock frequency, we get:
Time period = 1 / 16 MHz Time period = 0.0625 microseconds
Therefore, the time period for the timer in an 8051 based
system with a 16 MHz crystal frequency is 0.0625
microseconds or 62.5 nanoseconds.
Q6: Write uses of microcontroller in home and industry?
By ANAS 96 WWW.DAENOTES1.COM
Ans: A compact computer on a single VLSI integrated circuit
chip, used for specific functions is called a microcontroller.
Uses of microcontrollers in home:
1) Home automation systems: Microcontrollers are used to
automate various home appliances, such as lights, fans, air
conditioners, and security systems, which can be
controlled using a smartphone or other smart devices.
2) Robotics and DIY projects: Microcontrollers are used in
robotics and DIY projects to control the movement and
actions of robots, sensors, and other devices.
3) Consumer electronics: Microcontrollers are used in
consumer electronics, such as television sets, refrigerators,
washing machines, and ovens, to provide advanced
features and control functionality.
4) Gaming consoles: Microcontrollers are used in gaming
consoles to provide advanced control and processing
capabilities for gaming applications.
5) Smart home devices: Microcontrollers are used to power
smart home devices, such as smart locks, smart
thermostats, and smart speakers, that can be controlled
using a smartphone or other smart devices.
Uses of microcontrollers in industry:
1) Process control: Microcontrollers are used in industrial
automation systems to control various processes, such as
temperature, pressure, and flow control in manufacturing
plants.
By ANAS 97 WWW.DAENOTES1.COM
2) Robotics and automation: Microcontrollers are used to
control the movement and actions of robots in
manufacturing, assembly, and packaging operations.
3) Control systems: Microcontrollers are used to control
various industrial systems, such as conveyor belts, pumps,
and motors, in industries like food processing, automotive,
and textiles.
4) Data acquisition and analysis: Microcontrollers are used
for data acquisition and analysis in various industrial
applications, such as monitoring equipment, measuring
environmental conditions, and analyzing performance
metrics.
5) Medical devices: Microcontrollers are used in medical
devices, such as insulin pumps, pacemakers, and heart
monitors, to control and regulate the delivery of
medication and monitor patient health.
Overall, microcontrollers are used extensively in both home
and industry for their ability to provide advanced control,
automation, and processing capabilities in a wide range of
applications.
Q7: Define Interrupts and its types?
Ans: An interrupt is a signal or instruction that causes the
current process to be temporarily stopped while a service
routine is run.
OR
By ANAS 98 WWW.DAENOTES1.COM
In microcontroller programming, an interrupt is a signal that
causes the microcontroller to temporarily stop its current
task and execute a specific routine, known as an interrupt
service routine (ISR), in response to the interrupt signal.
Interrupts allow the microcontroller to respond quickly to
external events and perform multiple tasks simultaneously.
There are several types of interrupts in microcontrollers:
1) External Interrupts: These interrupts are generated by
external devices, such as sensors or switches, that are
connected to the microcontroller's input pins. When an
external event occurs, the microcontroller can be
programmed to execute an ISR that responds to the event.
2) Timer Interrupts: These interrupts are generated by the
microcontroller's internal timer/counter unit when a
preset time interval has elapsed. Timer interrupts can be
used to perform tasks at regular intervals, such as updating
a display or monitoring a sensor.
3) Serial Interrupts: These interrupts are generated by the
microcontroller's serial communication unit when data is
received or transmitted over a serial port. Serial interrupts
are commonly used in communication protocols, such as
UART or SPI, to ensure reliable data transmission.
4) Software Interrupts: These interrupts are generated by
software running on the microcontroller, rather than
external events or hardware. Software interrupts are often
used to implement multi-tasking or to handle exceptional
conditions, such as errors or timeouts.
By ANAS 99 WWW.DAENOTES1.COM
5) Watchdog Timer Interrupts: These interrupts are
generated by the microcontroller's watchdog timer when it
detects that the system is stuck in a loop or has crashed.
Watchdog timer interrupts can be used to reset the
microcontroller and recover from a system failure.
Overall, interrupts are an essential feature of
microcontrollers that allow them to respond quickly to
external events and perform multiple tasks simultaneously.
By using interrupts, programmers can create more efficient
and responsive systems.
Q8: Describe arithmetic operations?
Ans: Arithmetic instructions are a type of instruction set used
in microcontroller programming to perform various
arithmetic operations, such as addition, subtraction,
multiplication, and division. These instructions are used to
manipulate data stored in the microcontroller's memory or
registers.
The most common arithmetic instructions include:
1) ADD - adds the value of an operand to the accumulator
register.
2) SUB - subtracts the value of an operand from the
accumulator register.
3) INC - increments the value of an operand by 1.
4) DEC - decrements the value of an operand by 1.
5) MUL - multiplies the value of an operand with the
accumulator register.
MAX1112
MAX1112 is a 16-bit, low-power, successive-approximation
analog-to-digital converter (ADC) manufactured by Maxim
Integrated. It is a single-channel ADC that can be used to
convert analog signals into digital data for use in