Assignment 1
1. List specifications of 8051 microcontroller.
1) 8- bit data bus and 8- bit ALU.
2) 16- bit address bus – can access maximum 64KB of RAM and ROM.
3) On- chip RAM -128 bytes (Data Memory)
4) On- chip ROM – 4 KB (Program Memory)
5) Four 8-bit bi- directional input/output ports.( P0 P1 P2 P3 )
6) Programmable serial ports i.e. One UART (serial port)(RXD TXD)
7) Two 16- bit timers- Timer 0& Timer 1
8) Works on crystal frequency of 11.0592 MHz
9) Has power down and idle mode in microcontroller when no operation is
performed.
10) Six interrupts are available.
2. Compare address bus and data bus used in 8051.
Sr. No. Address Bus Data Bus
1 A bus that is used to A bus that is used to
specify a physical address transmit data
in memory among components
2 Unidirectional Bidirectional
3 Helps to transfer memory Helps to send and receive
address of data and I/O data
4 16 bit address bus in 8051 8 bit data bus in 8051
3. Define the term BUS related to microprocessor/controller and list
different buses used in microcontroller.
BUS: A Bus is a set of physical connections used for communication
between CPU andperipherals.
Different buses used in microcontroller are:
1. Address Bus
2. Data Bus
3. Control Bus
4. Compare data memory and program memory.
Sr.No . Program Memory(ROM) Data Memory (RAM)
1. It is used for storing It is used for storing
the hexadecimal codes of the temporary variable data
program to be executed i.e. and intermediate
Instructions. results
2. Program Memory of 8051 is Data Memory of 8051 is
4kB 128bytes
5. List SFRs in 8051. ( Special Function Registers )
1. ACC
2. B registers
3. DPH
4. DPL
5. Stack pointer SP
6. PSW : Program Status Word
7. Port P0
8. Port P1
9. Port P2
10. Port P3
11. Serial data buffer(SBUF ),
12. serial control (SCON)
13. TCON,
14. TMOD,
15. TL0
16. TL1,
17. TH0
18. TH1
19. Power control(PCON) ,
20. Interrupt Enable(IE),
21. Interrupt Priority(IP)
6. Draw the format of PSW register of 8051 microcontroller and
explain the function of eachbit.
1. CY: Carry flag.
This flag is set whenever there is a carry out from the D7 bit after an 8 bit
addition or subtraction. It can also be set to 1 or 0 directly by instructions
such as “SETB C” and CLR C”where “SETB C” stands for “set bit carry”
and “CLR C” for “clear carry”.
2. AC: Auxiliary carry flag
If there is a carry from D3 to D4 during an ADD or SUB operation, this bit
is set.
This flag is used by instructions that perform BCD (binary coded decimal)
arithmetic.
3. F0: Available to the user for general purposes.
4. RS0, RS1: Register bank selects bits
These two bits are used to select one of the four register banks from
internal RAM as shown in given table. The user can use only one bank of
register at one time. By default , bank 0 gets selected.
5. OV: Overflow flag
This flag is set whenever the result of a signed number operation is too
large, causing - order bit to overflow into the sign bit. In general, the carry
flag is used to detect errors in unsigned arithmetic operations. The overflow
flag is only used to detect errors in signed arithmetic operations.
6. P: Parity flag
The parity flag reflects the number of 1s in the A (accumulator) register
only. If the A register contains an odd number of 1s, then P=1. P=0 if A has
an even number of 1s.
7. Describe 8051 microcontroller as boolean processor.
8051 processor is a CPU that can perform some operation on a data
and gives the output.
The 8051 processor contains a complete Boolean processor for
single-bit operations.
The internal RAM contains 128 addressable bits, and the SFR space
supports up to 128other addressable bits.
All port lines are bit-addressable, and each can be treated as a
separate single-bit port.
The instructions that access these bits are not only conditional
branches but also a complete set of move, set, clear, complement,
OR, and AND instructions.
The 8051 instruction set is optimized for the one bit operations.
The Boolean processor provides direct support for bit manipulation
and testing of individual bit allows the use ofsingle bit variable to
perform logical operations therefore 8051 can be used to
solveBoolean expression. Bits may be set or cleared in a single
instruction.
Eg: 1) C means clear the carry bit
2) SETB 20h means set the memory bit with bit address
20H
8. Explain function of following pins of 8051
(i) Pin 31
(ii) Pin 29
(iii) Pin 21-28
i) Pin 31-EA :It is and active low I/P to 8051 microcontroller. When
(EA)= 0, then8051 microcontroller access from external program
memory (ROM) only. When (EA) = 1,then it access internal and
external program memories (ROMS).
ii) Pin 29- PSEN :This is an output pin. PSEN stands for “program store
enable.” It is active low O/P signal. It is used to enable external program
memory (ROM). When [PSEN(bar)]=0, then external program memory
becomes enabled and micro controller read content of external memory
location. Therefore it is connected to (OE) of external ROM.
iii) Pin 21-28: A8 – A15 :These pins are known as Port 2. It serves as I/O
port. Each pin is bidirectional Input /Output with internal pull – up
resistors. Besides the Input /Output, when external memory is interfaced,
PORT 2 pins act as the higher-order address bus. (A8-A15)
9. State the alternate pin functions of port 3 of 8051.
Pin Name Alternate Function
P3.0 RXD Serial input line
P3.1 TXD Serial output line
P3.2 INTO External interrupt 0
P3.3 INT1 External interrupt 1
P3.4 T0 Timer0 external input
P3.5 T1 Timer1 external input
P3.6 WR External data memory write strobe
P3.7 RD External data memory read strobe
10. Differentiate between
1)Harvard and Von-neuman architecture
2)Microprocessor and Microcontroller
Harvard Architecture and Von-neuman architecture
11. Microprocessor and Microcontroller
12. Sketch the internal memory organization in 8051.
Assignment 2
i. Write a program to move data from memory location 40 H to Accumulator.
2. Write a program to move data from accumulator to memory location 30h.
3. Write a program to move data from accumulator to memory location 30h
using immediate and indirect addressing mode.
4. List out any two instructions of following addressing modes:
a. Immediate addressing. (ii) Register addressing.
5. Write any eight data transfer Instructions.
6. Write any eight Arithmetic Instructions.
7. Write any eight Logical Instructions.
8. Write any eight Boolean processor Instructions.
9. Write a program to transfer a block of 5 bytes of data from internal source
memory location 20H to internal destination memory location 40H.
Assignment 3
Q 2. Write steps for software development cycle.
The steps for the software development Cycle
Defines the processor or processing device family as well as various versions for the target
system.
Define source code windows i.e. detail information of source code with labels and
symbolic arguments as execution goes on for each single step.
Define the processor registers i.e. detail information of the registers as the execution goes
on for each step or for each single module.
Define detail information of Ports and target system.
Editor to edit source code files, initial data files, data and tables.
Define assembler or complier for the program test with link library.
Finally execute source code to check either target system is working properly or not.
Q 3. List software development tools in microcontroller based systems
Various software development tools in microcontroller based systems are:-
1. Editor
2. Assembler
3. Cross assembler
4. Compiler
5. Cross compiler
6. Locators/Linkers
7. Debugger
8. Simulators
Q 4. Write function of editor and assembler in software development Cycle
Editor:-•
An editor is a program which helps you to construct your assembly language program in
right format so that the assembler will translate it correctly to machine language.
Assembler:-
• An assembler is programs that translate assembly language program to the correct
binary code for each instruction i.e. machine code and generate the file called as Object file
with extension .obj and list file with extension .lst extension.
Q 5. Write function of compiler and linker in software development Cycle
Compiler:-
•It is a computer program that transforms the source code written in a programming or source
language into another computer language i.e. target language i.e. binary code known as
object code.
Linker/Locator:-
Linker is a program in a system which helps to link a object modules of program into a single
object file.
Q 6. Write function of cross compiler and cross assembler in software development Cycle
Cross assembler:-A cross-assembler is an assembler that runs on a computer with one type
of processor but generates machine code for a different type of processor.
Cross compiler:-
•It is used to create executable code other than one on which the compiler is run. They are
used to generate executables for embedded systems or multiple platforms.
Q7. What are the power-saving modes available in the 8051 microcontroller?
The 8051 microcontroller has two main power-saving modes:
Idle Mode
Power-down Mode
Q 8. . What happens in Idle Mode?
In Idle Mode:
The CPU stops working, but peripherals (timers, serial port, and interrupts)
remain active.
The oscillator and clock circuitry continue to operate.
Power consumption is reduced but not minimized.
The system can wake up from an interrupt.
Q 9. What happens in Power-down Mode?
In Power-down Mode:
The oscillator stops completely, and all operations halt.
Power consumption is minimized to near zero.
The only way to exit this mode is through a hardware reset.
Q 10. How can the 8051 enter Idle Mode?
The 8051 enters Idle Mode by setting bit 0 (IDL) of the PCON (Power Control) register:
MOV PCON, #01H ; Enter Idle Mode
The microcontroller wakes up from an interrupt or hardware reset.
Q 11. How can the 8051 enter Power-down Mode?
The 8051 enters Power-down Mode by setting bit 1 (PD) of the PCON register:
MOV PCON, #02H ; Enter Power-down Mode
Q 12. What are the advantages of using these power-saving modes?
Idle Mode conserves power while keeping peripherals running, making it useful for
temporary pauses.
Power-down Mode significantly reduces power consumption, ideal for battery-
powered applications.
Q 13. Give the Comparison of 8051, 8031 & 8751.
Feature 8051 8031 8751
4 KB On- No On-chip ROM 4 KB EPROM
ROM
chip (External ROM (Erasable &
Type
ROM needed) Programmable)
128
RAM 128 Bytes 128 Bytes
Bytes
I/O 4 Ports (32 I/O 4 Ports (32 I/O 4 Ports (32 I/O
Ports Pins) Pins) Pins)
Timers 2 Timers 2 Timers 2 Timers
Serial Yes
Yes (UART) Yes (UART)
Communication (UART)
External Yes (Up to 64 Yes (Up to 64
Yes (Up to 64 KB
Memory KB KB
ROM/RAM)
Support ROM/RAM) ROM/RAM)
Power-
Idle & Idle & Power- Idle & Power-
Saving
Power-down down down
Modes
Interrupts 5 Interrupts 5 Interrupts 5 Interrupts
12 MHz 12 MHz 12 MHz
Clock Speed
(Standard) (Standard) (Standard)
Q 14. Write an ALP to multiply two 8 bit numbers 23H and 02H.
Assignment 4
1. Draw the format of TCON.
2. Draw the format of TMOD.
3. List SFR in 8051 (any four).
4. Draw the format of TCON register of 8051 and describe the function of each bit of it.
5. Draw the format of TMOD register of 8051 and describe the function of each bit of it.
6. List different timer modes of 8051 microcontroller and describe mode 2 with neat sketch.
7. List software and hardware interrupts used in 8051 with their vector addresses and priorities
8. Draw and explain Internal Port structure of Port 0 and Port 1 of 8051 microcontroller
9. Draw the format of IE SFR.
10. Draw the format of IP SFR.
11. List software and hardware interrupts used in 8051 with their vector addresses and priorities.
12. Explain the interrupt structure of 8051.
13. Explain processes of interrupt enabling and disabling in 8051.
Assignment 5
1. Write an assembly language program to generate continuous square wave of 1KHz on P1.5
using Mode1 of Timer 0. The XTAL frequency is 11.0592 MHz.
2. Write an assembly language program to generate continuous square wave of 2KHz on P1.5
using Mode2 of Timer 0. The XTAL frequency is 11.0592 MHz.
3. Calculate the number of address lines required to access 16 KB ROM
4. Draw and explain the interfacing of DAC to 8051.
5. Explain the interfacing diagram of DAC to 8051. Write an ALP to generate triangular
waveform using DAC.
6. Explain the interfacing diagram of DAC to 8051. Write an ALP to generate Square waveform
using DAC.
7. Draw the Interfacing diagram of 2 Kbyte RAM and 2Kbyte EPROM to 8051.Write the address
range.
8. Draw the Interfacing diagram of 8 Kbyte RAM and 8Kbyte EPROM to 8051.Write the address
range.
9. Draw the Interfacing diagram of 1 Kbyte RAM. Write the address range.
Assignment 7
1. State the alternative functions of port 3 of 8051
2. List the ports of 8051 microcontroller.
3. State the features of serial port of 8051.(any 10 )
4. Draw the format of SCON register and explain each bit.
5. Draw the format of PCON register and explain each bit.
6. Draw interfacing diagram of 4x4 keyboard matrix with 8051 Microcontroller
7. Draw interfacing of 16 × 2 LCD with 8051 and state the function of EN and RS pin of LCD
8. Develop an ALP to transmit message “MSBTE” serially at baud rate 4800 8 bit data, 1 stop
bit. Assume crystal frequency of 11.0592 MHz.
9. Develop an ALP to transmit message “WELCOME” serially at baud rate 4800 8 bit data, 1
stop bit. Assume crystal frequency of 11.0592 MHz.
10. Draw labelled diagram to interface LED to pin P1.7 of 89c51. Write ALP to blink the LED.
11. Draw the Interfacing of common cathode 7 Segment Display with 8051 Microcontroller.
12. Draw the Interfacing of common Anode 7 Segment Display with 8051 Microcontroller.