Anna University, Chennai
SRINIVASAN ENGINEERING COLLEGE, PERAMBALUR DET OF ECE
V TH SEM
EC2304 – MICROPROCESSORS AND MICROCONTROLLERS UNIT I
INTRODUCTION TO 8 BIT AND 16 BIT MICROPROCESSORS – H/W ARCHITECTURE
1. What is Microprocessor ?
It is a program controlled semiconductor device (IC}, which fetches, decode and executes instructions.
The basic units or blocks of a microprocessor are ALU, an array of registers and control unit.
3. What is Software and Hardware?
The Software is a set of instructions or commands needed for performing a specific task by a programmable device or a computing machine. The Hardware refers to the components or devices used to form computing machine in which the software can be run and tested.
Without software the Hardware is an idle machine.
4. What is assembly language?
The language in which the mnemonics (short -hand form of instructions) are used to write a program is called assembly language. The manufacturers of microprocessor give the mnemonics.
5. What are machine language and assembly language programs?
The software developed using 1's and 0's are called machine language, programs. The software developed using mnemonics are called assembly language programs.
6. What is the drawback in machine language and assembly language, programs?
The machine language and assembly language programs are machine dependent. The programs developed using these languages for a particular machine cannot be directly run on another machine
7. Define bit, byte and word.
A digit of the binary number or code is called bit. Also, the bit is the fundamental storage unit of computer memory. The 8-bit (8-digit) binary number or code is called byte and 16-bit
binary number or code is called word. (Some microprocessor manufactures refer the basic data size operated by the processor as word).
8. What is a bus?
Bus is a group of conducting lines that carries data, address and control signals.
9. Why data bus is bi-directional?
The microprocessor has to fetch (read) the data from memory or input device for processing and after processing, it has to store (write) the data to memory or output device. Hence the data bus is bi-directional.
10. Why address bus is unidirectional?
The address is an identification number used by the microprocessor to
identify or access a memory location or I / O device. It is an output signal from the processor. Hence the address bus is unidirectional.
11. What is the function of microprocessor in a system?
The microprocessor is the master in the system, which controls all the activity of the system. It issues address and control signals and fetches the instruction and data from memory. Then it executes the instruction to take appropriate action.
12. Why interfacing is needed for 1/0 devices?
Generally I/O devices are slow devices. Therefore the speed of I/O devices does not match with the speed of microprocessor. And so an interface is provided between system bus and I/O devices.
13. What is the difference between CPU bus and system bus?
The CPU bus has multiplexed lines but the system bus has separate lines for each signal. (The multiplexed CPU lines are demultiplexed by the CPU interface circuit to form system bus).
14..What does memory-mapping mean?
The memory mapping is the process of interfacing memories to microprocessor and allocating addresses to each memory locations.
15..What is interrupt 1/0?
If the 1/0 device initiate the data transfer through interrupt then the 1/0 is called interrupt driven 1/0.
1. Explain the Architecture of 8086 in Detail
2. Write Briefly about Direct memory Access
3. Explain the External memory addressing in 8086
4. Discuss the Interrupt types of 8086 micro processor
5. Explain the 8086 interrupt types in detail
6. What are the peripheral I/O instructions write its syntax and explain the same with the timing diagram
16 BIT MICROPROCESSOR INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
1. Define mnemonics.
The short-hand form of describing the instructions are called mnemonics. The mnemonics are given by the manufacturers of microprocessors and programmable devices.
2. What is processor cycle (Machine cycle) ,Instruction cycle, fetch and execute cycle?
The processor cycle or machine cycle is the basic operation performed by the processor. To execute an instruction, the processor will run one or more machine cycles in a particular order. The sequence of operations that a processor has to carry out while executing the instruction is called Instruction cycle. Each instruction cycle of a processor in tum consists of a number of machine cycles. In general, the instruction cycle of an instruction can be divided into fetch and execute cycles. The fetch cycle is executed to fetch the opcode from memory. The execute cycle is executed to decode the instruction and to perform the work instructed by the instruction.
3. What is the need for timing diagram?
The timing diagram provides information regarding the status of various signals, when a machine cycle is executed. The knowledge of timing
diagram is essential for system designer to select matched peripheral devices like memories, latches, ports, etc., to form a
4. What is T -state?
The T-state is the time period of the internal clock signal of the processor. The time taken by the processor to execute the machine cycle is expressed in T-state.
5. Define opcode and operand.
Opcode (Operation code) is the part of an instruction / directive that identifies a specific operation.
Operand is a part of an instruction / directive that represents a value on which the instruction acts.
6. What is meant by memory mapping? What is memory access time ?
The memory mapping is the process of interfacing memories to microprocessor and allocating addresses to each memory locations. The memory access time is the time taken by the processor to read or write a memory location. During read operation it is the time between a valid address on the bus and end of read control signal. During write operation it is the time between a valid address on the bus and the end of write control signal.
7. Compare the memory mapped I/0 and standard I/0 mapped I/0.
Memory Mapped 1/0 Standard 1/0 mapped 1/0
1. 16-bit address is allotted to 1. 8 -bit address is allotted to an I/O
an I/O device device.
2. The devices are accessed by 2. The devices are accessed by I/O read or
I/O write cycle. memory read or memory write cycle.
3. All instructions related to 3. Only IN and OUT instructions memory can be used for can be used for data transfer data transfer.
4 . A large number of I/O ports 4. Only 256 ports can be interfaced. can be interfaced.
8. What is an Interrupt ? Haw the interrupt are classified ?
Interrupt is a signal send by an external device to the processor so as to request the processor to perform a particular task or work. They are three methods of classifying interrupts
Method I :The interrupts are classified into Hardware and Software interrupts
Method II:The interrupts are classified into vectored and Non- Vectored interrupt
9. What is Vectored and Non- Vectored interrupt?
When an interrupt is accepted, if the processor control branches to a specific address defined by the manufacturer then the interrupt is called vectored interrupt.
In Non-vectored interrupt there is no specific address for storing the interrupt service routine. Hence the interrupted device should give the address of the interrupt service routine.
10.What is Polling ? What are the different types of Polling?
Polling is a scheme or an algorithm to identify the devices interrupting the
processor. Polling is employed when multiple devices interrupt the processor through one interrupt pin of the
processor. The polling can be classified into software and hardware polling. In software polling the entire polling process is govern by a prograrn.1n hardware polling, the hardware takes care of checking the status of interrupting devices and allowing one by one to the
11. What is masking and why it is required?
Masking is preventing the interrupt from disturbing the current program execution. When the processor is performing an important job (process) and if the process should not be interrupted then all the interrupts should be masked or disabled. In processor with multiple 'interrupts, the lower priority interrupt can be masked so as to prevent it from interrupting, the execution of interrupt service routine of higher priority interrupt.
12. What are the modes in which 8086 can operate?
The 8086 can operate in two modes and they are minimum (or uniprocessor)
mode and maximum ( or multiprocessor) mode.
How clock signal is generated in 8086? What is the maximum internal clock frequency of 8086?
The 8086 does not have on-chip clock generation circuit. Hence the clock generator chip, 8284 is connected to the CLK pin of8086. The clock signal supplied by 8284 is divided by three for internal use. The maximum internal clock frequency of8086 is 5MHz.
13. What is pipelined architecture?
In pipelined architecture the processor will have number of functional units
and the execution time of functional units are overlapped. Each functional unit works independently most of the time.
14. What are the functional units available in 8086 architecture?
The bus interface unit and execution unit are the two functional units available in 8086 architecture.
15. List the segment registers of 8086.
The segment registers of 8086 are Code segment, Data segment, Stack segment and Extra segment registers.
16. What is the difference between segment register and general purpose register?
The segment registers are used to store 16 bit segment base address of the four memory segments. The general purpose registers are used as the source or destination register during data transfer and computation, as pointers to memory and as counters.
17. What is queue? How queue is implemented in 8086?
A data structure which can be accessed on the basis of fIrst in fIrst out is called queue. The 8086 has six numbers of 8-bit FIFO registers, which is used for instruction queue.
18. Write the special functions carried by the general purpose registers of
The special functions carried by the registers of 8086 are the following. Register Special function
AX 16-bit Accumulator AL 8-bit Accumulator BX Base Register
CX Count Register
DX .Data Register
19. Write the flags of 8086.
The 8086 has nine flags and they are
1. Carry Flag (CF) 6. Overflow Flag (OF)
2. Parity Flag (PF) 7. Trace Flag (TF)
3. Auxiliary carry Flag (AF) 8. Interrupt Flag (IF)
4. Zero Flag (ZF) 9. Direction Flag (DF)
5. Sign Flag (SF)
20. What are control bits?
The flags TF, IF and DF of8086 are used to control the processor operation and so they are called control bits.
36. Describe the difference between the instructions MOV AX,2437H and
Difference between the instructions MOV AX,2437H and MOV AX,[2437H] are former instruction takes 2437 as 16-bit data and latter instruction takes 2437 as 16-bit address.
21. State the function of Direction flag in 8086.
Direction flag is used with string instructions. If DF= 0, the string is processed from its beginning with the first element having the lowest
address. Otherwise, the string is processed from the high address towards the low address.
22. In 8086 processor the code segment contains 4000H and instruction pointer contains 9F20H. Find the memory location addressed by the processor. Segment address 4000 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Shifted to left by 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 four bits + Offset address 1 0 0 1 1 1 1 1 0 0 1 0 0 0 0 0
0 1 0 0 1 0 0 1 1 1 1 1 0 0 1 0 0 0 0 0
Physical address 49F20H
23. Mention the three operating modes of Intel 80386 processor. i. Real Mode.
ii. Protected Mode.
iii. Virtual 8086 Mode.
24. What happens in 8086 processor, when
a. overflow of sum occurs during addition of signed numbers. b. overflow of quotient occurs during division operation.
a. When overflow of sum occurs during addition of signed numbers, overflow flag is set to one (OVF =1).
b. When overflow of quotient occurs during division operation, type
0 (divide by zero ) interrupt is generated.
PART – B
1. Write about Instruction set of 8086
2. Describe the addressing mode of 8086.
3. Draw and explain the flag register of 8086 in brief.
4. Explain the 8086 bit manipulation instruction with an example of each
5. Write an 8086 program to convert BCD to Binary
6. Write an 8086 ALP to sort the array of elements in ascending order
7. Describe the action taken by 8086 when INTR pin is activated
8. Explain the data Transfer group and logical group of 8086 instructions
MICROPROCESSOR PERIPHERAL INTERFACING PART – A
1. What is the need for interrupt controller?
The interrupt controller is employed to expand the interrupt inputs. It can handle the interrupt request from various devices and allow one by one to the processor.
2. List some of the features of INTEL 8259 (Programmable Interrupt
i) It manage eight interrupt request.
ii) The interrupt vector addresses are programmable. iii) The priorities of interrupts are programmable.
iv) The interrupt can be masked or unmasked individually.
3. Write the various functional blocks of INTEL 8259 ?
The various functional blocks of 8259 are Control logic, Read/ Write logic, Data bus buffer, IRR, ISR,IMR, Priority resolver and cascade buffer
IRR - Interrupt Request Register
ISR - In-Service Register
IMR Interrupt Mask Register,
4. What is Master and Slave 8259 ?
When 8259's are connected in cascade, one 8259 will be directly interrupting 8085 and it is called master 8259, To each interrupt request input of master 8259, one slave 8259 can be
connected, The 8259 's interrupting the master 8259 are called slave 8259.
5. How 8259 is programmed?
The 8259 is programmed by sending
i) Initialization Command Words (ICWs) and ii)Operational Command Words (OCWs).
6. What is a programmable peripheral device ?
If the functions performed by a peripheral device can be altered or changed by a program instruction then the peripheral device is called programmable device. Usually the programmable devices will have control registers. The device can be programmed by sending control word in the prescribed format to the control register.
7. What is handshake port ? Explain the working of a handshake input port and output port.
In handshake port, signals are exchanged between I/O device and port or port and processor for checking or informing various condition of the device.In handshake input operation, the input device will check whether the port is empty or not. If the port is empty then it will load data to port. When the port receives the data, it will inform the processor for read operation. Once the data have been read by the processor, the port will signal the input device that it is empty. Now the input device can load another data to port and the above process is repeated.
In handshake output operation, the processor will load a data to port. When the port receives the data, it will inform the output device to collect the data. Once the output device accepts the data,the port will inform the processor that it is empty. Now the processor can load another data to port and the above process is repeated.
8. What are the internal devices of 8255 ?
The internal devices of 8255 are port-A, port-B and port-C.
The ports can be programmed for either input or output function in different operating modes.
9. What are the operating modes of port -A 8255?
The port-A of 8255 can be programmed to work in anyone of the following operating modes as input or output port.
Mode-0 : Simple 1/0 port. Mode-l: Handshake 1/0 port Mode-2 : Bidirectional 1/0 port
10. What are the functions performed by port-C of8255?
1. The port-C pins are used for handshake signals.
2. Port-C can be used as an 8-bit parallel 1/0 port in mode-0.
3. It can be used as two numbers of 4-bit parallel port in mode-0.
4. The individual pins of port-C can be set or reset for various control applications.
11. What are the different scan modes of of8279?
The different scan modes of8279 are decoded scan and encoded scan. In decoded scan mode, the output of scan lines will be similar to a 2-to-4 decoder. In encoded scan mode, the output of scan lines will be binary
count, and so an external decoder should be used to convert the binary count to decoded output.
12. What is baud rate ?
The baud rate is the.rate at which the serial data are transmitted. Baud rate
is defined as l/(The time for a bit cell). In some systems one bit cell has one data bit, then the baud rate and bits/sec are same.
13. What is USART ? What are the functions performed by INTEL 8251A? The device which can be programmed to perform Synchronous or Asynchronous serial communication is called USART (Universal Synchronous Asynchronous Receiver Transmitter). The INTEL 8251A is an example of USART.
The INTEL 825lA is used for converting parallel data to serial or vice versa. The data transmission or reception can be either asynchronously or synchronously. The 8251A can be used to interface MODEM and establish serial communication through MODEM over
14. What are the control words of 8251A and what are its functions ? The control words of 8251A are Mode word and Command word. The mode word informs 8251 about the baud rate, character length, parity and stop bits. The command word can be send to enable the data transmission and reception.
15. What is debouncing ?
When a key is, pressed it bounces for a short time. If a key code is
generated immediately after sensing a key actuation, then the processor will generate the same keycode a number of times.(A key typically bounces for
10 to 20 msec). Hence the processor has to wait for the key bounces to
settle before reading the keycode. This process is called keyboard debouncing.
16. What is the difference in programming the 8279 for encoded scan and decoded scan?
If the 8279 is programmed for decoded scan then the output of scan lines will be decoded output and if it is programmed for, encoded scan then the output of scan lines will be binary count. In encoded mode, an external decoder should be used to decode the scan lines.
17. What are the different types of ADC?
The different types of ADC are successive approximation ADC, counter type ADC flash type ADC, integrator converters and voltage-to-frequency converters.
18. What is DMA Controller?
Direct Memory Access is an I/O technique used for high speed data transfer. In DMA, the MPU releases the control of the buses to a device called a DMA controller. The controller manages data transfer between memory and a peripheral under its control, thus bypassing the MPU.
PART - B
19. Describe the working of 8259 Interrupt controller
20. Draw the block diagram of 8279 and explain the function of each block.
21. Describe the DMA controller 8237 Internal architecture
22. Discuss the architecture and working of 8253 timer
23. With a neat block diagram explain PPI.
24. Explain the working of Mode 3 operation of timer with a suitable timing diagram
25. Differentiate between Synchronous and Asynchronous modes of serial communications. Interpret the mode of operation of 8251 if its mode instruction command word is initialized to FE H.
26. With the help of block diagram explain the operation of USART
8 BIT MICROCONTROLLER- H/W ARCHITECTURE, INSTRUCTION SET AND PROGRAMMING
1. . What is mean by microcontroller?
A device which contains the microprocessor with integrated peripherals like memory, serial ports, parallel ports, timer/counter, interrupt controller, data
acquisition interfaces like
ADC,DAC is called microcontroller.
2. Explain DJNZ instructions of intel 8051 microcontroller?
a. DJNZ Rn, rel
Decrement the content of the register Rn and jump if not zero. b. DJNZ direct , rel
Decrement the content of direct 8-bit address and jump if not zero.
3. Explain the contents of the accumulator after the execution ot the following program segments:
MOV A,#3CH MOV R4,#66H ANL A,R4
A 3C R4 66
4. State the function of RS1 and RS0 bits in the flag register of intel 8051 microcontroller?
RS1 , RS0 – Register bank select bits
RS1 RS0 Bank
0 Bank 0
1 Bank 1
0 Bank 2
0 Bank 3
5. Write a program using 8051 assembly language to change the date 55H stored in the lower byte of the data pointer register to AAH using rotate instruction.
MOV DPL,#55H MOV A, DPL
Label :SJMP Label
6. Give the alternate functions for the port pins of port3? RD WR T1 T0 INT1 INT0 TXD RXD
RD – Read data control output. WR – Write data control output.
T1 – Timer / Counter1 external input or test pin. T0 – Timer / Counter0 external input or test pin. INT1- Interrupt 1 input pin.
INT 0 – Interrupt 0 input pin.
TXD – Transmit data pin for serial port in UART mode. RXD - Receive data pin for serial port in UART mode.
7. Specify the single instruction, which clears the most significant bit of B
register of 8051, without affecting the remaining bits.
Single instruction, which clears the most significant bit of B
register of 8051, without affecting the remaining bits is CLR B.7.
8. Explain the function of the pins PSEN and EA of 8051. PSEN :
PSEN stands for program store enable. In 8051 based system in which an external ROM holds the program code, this pin is connected to the OE pin of the ROM.
EA : EA stands for external access. When the EA pin is connected to Vcc, program fetched to addresses 0000H through 0FFFH are directed to the internal ROM and program fetches to
addresses 1000H through FFFFH are directed to external ROM/EPROM. When the EA pin is grounded, all addresses fetched by program are directed to the external ROM/EPROM.
9. Explain the 16-bit registers DPTR and SP of 8051.
DPTR: DPTR stands for data pointer. DPTR consists of a high byte (DPH) and a low byte (DPL). Its function is to hold a 16-bit address. It may be manipulated as a 16-bit data register or as
two independent 8-bit registers. It serves as a base register in indirect jumps, lookup table instructions and external data transfer.
SP: SP stands for stack pointer. SP is a 8- bit wide register. It is
incremented before data is stored during PUSH and CALL instructions. The stack array can reside anywhere in on-chip RAM. The stack pointer is initialized to 07H after a reset. This causes the stack to begin at location
10. Name the special functions registers available in 8051. a. Accumulator
b. B Register
c. Program Status Word.
d. Stack Pointer. e. Data Pointer. f. Port 0
g. Port 1 h. Port 2 i. Port 3
j. Interrupt priority control register.
k. Interrupt enable control register.
1. Explain the operations of 8051.
2. Describe Interrupts and instruction set of 8051
3. Explain the architecture of 8051 with its diagram
4. Explain the programming of counter and Timer of 8051
5. Explain different addressing modes used in 8051 microcontroller
6. Explain serial communication interface available in 8051
7. Explain how 8051 distinguishes between internal and external ROMs
8. Draw and explain the functions of bits in TMOD and TCON registers of
SYSTEM DESIGN USING MICRO PROCESSOR & MICROCONTROLLER
1. Write down the different operating modes for serial communication of 8051. Serial communication of 8051 operate under four modes. They are mode 0 , mode 1, mode 2 and mode3 .SM0 and SM1 bits of SCON register specifies the mode.
SM0 SM1 Mode
0 0 0 Baud rate fixed.
0 1 1 8-bit data, 1 stop bit, 1 start bit. Baud rate variable.
1 0 2 8-bit data, 9th programmable bit,1 stop bit, 1 start bit, Baud rate fixed.
1 1 3 8-bit data, 9th programmable bit,1 stop bit, 1 start bit, Baud rate variable.
2. Explain the register IE format of 8051. EA - ET2 ES ET1 EX1 ET0 EX0
EA- Enable all control bit.
ET2- Timer 2 interrupt enable bit. ES – Enable serial port control bit. ET1 – Enable Timer1 control bit.
EX1- Enable external interrupt1 control bit. ET0 – Enable Timer0 control bit.
EX0- Enable external interrupt0 control bit.
3. Compare Microprocessor and Microcontroller. Microprocessor Microcontroller
1 Microprocessor contains ALU,general purpose registers,stack pointer,
Microcontroller contains the circuitry of microprocessor and in addition it has built- in ROM, program counter, clock timing circuit and interrupt circuit. RAM, I/O devices, timers and counters.
1 It has many instructions to move data between memory and CPU.
It has one or two instructions to move data between memory and CPU.
3 It has one or two bit handling instructions. It has many bit handling instructions.
4 Access times for memory and I/O devices are more. Less access times for built-in memory and I/O devices.
5 Microprocessor based system requires more hardware.
Microcontroller based system requires less hardware reducing PCB size and increasing the reliability.
4. Name the five interrupt sources of 8051?. The interrupts are:
· External interrupt 0 : IE0 : 0003H
· Timer interrupt 0 : TF0 : 000BH
· External interrupt 1 : IE1 : 0013H
· Timer Interrupt 1 : TF1 : 001BH
· Serial Interrupt
Receive interrupt : RI : 0023H Transmit interrupt: TI : 0023H
5. Write a program to load accumulator A, DPH and DPL with 30H. MOV A,#30
MOV DPH,A MOV DPL,A
6. Write a program to subtract the contents of R1 of Bank0 from the contents of R0 of Bank2.
7.How the RS -232C serial bus is interfaced to TTL logic device ?
The RS-232C signal voltage levels are not compatible with TTL logic levels. Hence for interfacing TTL devices to RS-232C serial bus, level converters are used. The popularly used
level converters are MC 1488 & MC 1489 or MAX 232.
8. List some of the features of 8096 microcontroller. a. The 8096 is a 16-bit microcontroller.
b. The 8096 is designed to use in applications which require high speed calculations and fast I/O operations.
c. The high speed I/O section of an 8096 includes a 16 bit timer, a 16 bit counter, a 4 input programmable edge detector, 4 software timers and a 6- output programmable event generator.
d. It has 100 instructions, which can operate on bit,byte,word ,double words.
e. The bit operations are possible and these can be performed on any bit in the register file or in the special function register.
9. What is HS0 of 8096?
HS0: The High Speed Output unit (HS0) is used to trigger events at specific times with minimal CUP overhead. These events include : starting an A to D conversion, resetting Timer2, setting 4 software flags, and switching up to 6 output lines.
10. List the features of 8051 microcontroller? The features are
*single_supply +5 volt operation using HMOS technology.
*4096 bytes program memory on chip(not on 8031)
*128 data memory on chip.
*Four register banks.
*Two multiple mode,16-bit timer/counter.
*Extensive boolean processing capabilities.
*64 KB external RAM size
*32 bidirectional individually addressible I/O lines.
*8 bit CPU optimized for control applications.
11.Explain the operating mode0 of 8051 serial ports?
In this mode serial enters &exits through RXD, TXD outputs the shift clock.8 bits are transmitted/received:8 data bits(LSB first).The baud rate is fixed at
1/12 the oscillator frequency.
12. Explain the operating mode2 of 8051 serial ports?
In this mode 11 bits are transmitted(through TXD)or received (through RXD):a start bit(0), 8 data bits(LSB first),a programmable 9th data bit ,& a stop bit(1).ON transmit the 9th data bit (TB* in SCON)can be assigned the value of 0 or 1.Or for eg:, the parity bit(P, in the PSW)could be moved into TB8.On receive the 9th d ata bit go in to the RB8 in Special Function Register SCON, while the stop bit is ignored. The baud rate is programmable to either
1/32or1/64 the oscillator frequency.
13..Write A program to perform multiplication of 2 nos using 8051? MOV A,#data 1
MOV B,#data 2
MOV @DPTR,A(lower value) INC DPTR
MOVX @ DPTR,A
14. Write a program to mask the 0th &7th bit using 8051? MOV A,#data
MOVX @DPTR,A LOOP SJMP LOOP
15.Write about CALL statement in 8051?
There are two subroutine CALL instructions. They are
Each increments the PC to the 1st byte of the instruction & pushes them in to the stack.
16.Write about the jump statement?
There are three forms of jump. They are
LJMP(Long jump)-address 16
AJMP(Absolute Jump)-address 11
SJMP(Short Jump)-relative address
17.Write program to load accumulator ,DPH,&DPL using 8051? MOV A,#30
MOV DPH,A MOV DPL,A