Microcontroller & RISC Architecture (2 Marks - Question Bank)
Microcontroller & RISC Architecture (2 Marks - Question Bank)
PART- A
Short Questions & Answers
Compiled by
PROF. N.SHANMUGASUNDARAM,
Professor & Head, ECE Department,
Vidyaa Vikas College of Engineering & Technology
Tiruchengode – 637214, Namakkal Dt., T.N.
MICROCONTROLLER AND RISC ARCHITECTURE
(2 MARKS – Q & A)
Unit – I
INTRODUCTION TO INTEL 8051 ARCHITECTURE
1. What is microcontroller?
Microcontroller is a single IC which contains the CPU with integrated
peripherals like memory, serial ports, parallel ports, timer/counter, interrupt
controller, data acquisition interfaces like ADC, DAC.
On-chip On-chip
CPU
ROM RAM
Timers I/O Ports Serial Port
Internal blocks of Microcontroller
The PSW consists of four math flags and two register bank select bits. The
math flags are Carry, Auxiliary Carry, and Overflow and Parity flags.
The register bank select bits RS1 and RS0 are used to select any one of the
four register banks of the internal RAM. At any instant, the microcontroller
can work with (or access) only one register bank, which is selected by these
bits.
11. State the function of RS1 and RS0 bits in the flag register of 8051.
Each pin in I/O Ports of 8051 has i) Latch ii) tri-state buffers and iii) driver
transistor. Only Ports 1, 2, & 3 has internal pull-up resistor in collector
terminal of driver transistor.
20. Why all pins of a port is loaded with value “FF” before using it?
All ports of 8051 are configured by default as Output port.
Hence, to make it configured as Input Port, all pins of a port are loaded with
value “FF” i.e., 1111 1111.
Only XTAL (Crystal Oscillator) of 11.0592 MHz can provide such standard
baud rates, after down scaling down by 12, 32 at UART and by a factor set in
timer register TH1.
The modes of timer in 8051 are chosen with the help of two bits,
viz., M0 & M1 in TMOD register. The different modes of timer are as follows.
0 Timer operation
1 Counter operation
24. What is the significance of TRx bit in TCON register of 8051?
TRx bit in the TCON register is used to Start / Stop the timer register for
both timer and counter operation, by setting that bit with value ‘1’ or ‘0’.
In this mode, the timer register is used to generate the time delay using the
clock signal applied to the processor.
An initial count is loaded in the timer register. When the timer is started, the
timer register content gets incremented after every machine cycle. When the
timer register crosses (i.e., overflows) the count FFFFH and goes to 0000H,
the timer overflow flag in TCON register becomes set.
In this mode, the timer register is used to count the external events with the
help of external pulses received through the counter input (t0 & T1).
An initial count is loaded in the timer register. When the timer is started, the
timer register content gets incremented after every external pulse. When the
timer register crosses (i.e., overflows) the count FFFFH and goes to 0000H,
the timer overflow flag in TCON register becomes set. Hence, by loading
appropriate value in the timer register, counting of external event can be
performed using timer.
The serial communication in 8051 is carried out using two SFR registers,
1. SCON
2. SBUF
SCON register is used to control and set the mode of serial communication.
SBUF register is used to dump the data before serial transmission and hold
data after serial reception.
Note: Out of all modes, Mode-1 is commonly used mode for serial data transfer in 8051.
38. Explain how baud rate is calculated for serial data transfer in mode 1?
General Expression for setting baud rates using TH1 register is given below.
39. Explain how baud rate is set in 8051 for serial data transfer using
timer register?
Based on the baud rate needed for serial communication, the timer register
TH1 is loaded with values as per the following calculation.
3. List the steps to create the executable code from assembly program.
4. List the widely used assembler directives of 8051.
Assembler
S.No. Definition and usage
Directive
The ORG directive is used to indicate the origin of
1. ORG
the address of the assembly program
The DB directive is the most widely used data
directive in the assembler to define data. The
2. DB numbers can be in decimal, hex, or ASCII formats.
Regardless of which format is used, the assembler
converts the numbers into hex.
EQU stands for Equate. This directive is used to
3. EQU define a constant without occupying a memory
location.
The END directive is specified in the last line of the
4. END 8051 assembly program to indicate the assembler
the end of the source (.asm) file.
The instructions that read the latch are ANL, ORL, XRL, JBC, CPL, INC, DEC,
DJNZ, CLR PX.Y, SETB PX.Y, etc.
10. What is the limitation of Indirect addressing mode?
The indirect addressing mode is implemented using R0 & R1 registers which
are 8-bit wide. Hence, this mode supports accessing of internal Ram only.
Eg. If the content of Acc is 56H before SWAP instruction; the content in
Acc becomes 65H after execution of SWAP instruction.
This instruction compares two 8-bit numbers and the program control
branches to a specific location if the numbers are not equal. The branching is
done by relative addressing.
20. What are the registers that are used for Timer operations?
The two 16-bit timer registers are TIMER0 & TIMER1.
The two registers that control the operation of timers are TMOD and TCON
registers.
Interrupts Priority
IE0 – Ext. Interrupt 0
TF0 – Timer0 Flag
IE1 – Ext. Interrupt 1
TF1 – Timer1 Flag
RI / TI – Serial Comm. Interrupt
TF2 – Timer2 Flag (in 8052 only)
28. List the steps in executing an interrupt.
Upon activation of an interrupt, the microcontroller goes through the
following steps.
RETI stands for “Return from Interrupt’ and it makes the program control to
return to the main program after executing an Interrupt Sub Routine
program.
Interrupt Priority (IP) register helps to change the priority assigned to all
interrupts in 8051.
The 8-bit value in the timer register TH1 and the oscillator frequency (XTAL)
decides the baud rate for the serial communication in 8051.
3. List the status of RS, R/W and E pins for data & command operations
in LCD.
II Method: Send the data / command to LCD after checking the busy flag
(D7 bit of Status register) in LCD.
Step angle is the minimum angle of rotation made by the rotor of the
stepper motor. Based on the step angle, the no. of steps to make one
complete revolution varies accordingly.
9. How the speed of stepper motor can be controlled?
The speed of stepper motor can be controlled by introducing a time delay in
between the steps sequence.
11. What is the role of ULN2003IC in stepper motor interface with 8051?
As 8051 has limited capacity; ULN2003 driver IC is used to deliver the
required current to the coil windings and drive the stepper motor.
12. Draw the signal flow diagram of 8255 and describe its operation.
13. Draw the control word format for BSR mode operation in 8255.
14. Draw the 8255 interface diagram with ADC and 8051.
15. Programming example for 8255.
16. Draw the pin diagram of SRAM and DRAM.
The pin diagram of SRAM and DRAM is shown below.
17. Draw the two methods of address decoding logic used for external
memory.
19. Draw the interface diagram for external program memory with 8051.
21. Draw the interface diagram for external data & program memory
with 8051.
22. Find the address range of the given memory design?
The address lines used in memory is A0-A13 (14 lines) and the memory
capacity is 16KB (214 = 16KB).
As per the given address decoding logic, the address lines A14=1 and
A15=0. Therefore, the address range is as follows.
Each data byte in a block of data is sequentially added and the carry is
ignored in each addition. The final value obtained in such addition is called
Checksum byte.
Since Vref / 2 = 0.64 V; the full scale reference voltage Vref is 1.28 V.
Therefore, the output for Vin = ‘1111 1111’ is 1.28 V (i.e., Vref value).
29. In ADC804, what is the VRef/2 value for step size of 20mV?
The resolution of ADC804 is 8-bits and hence it can have 28 = 256 input
combinations.
If the step size is 20mV; then the full scale value for 256 combinations is
256 x 20mV = 5.12 V
Unit IV:
1. Define Pipelining.
Starting the execution of next instruction before the current instruction
execution is finished with the available hardware resources is called
pipelining. This is achieved by splitting the execution of each instruction for
more than one stage and allocating appropriate hardware for each stage. To
improve the utilization of hardware resources, and also the processor
throughput, pipelining organization is implemented.
8. What are the factors to be considered for low power circuit design?
• Minimize the power supply voltage, Vdd.
• Minimize the circuit activity, A.
• Minimize the number of gates.
• Minimize the clock frequency.
9. Mention the features of RISC which are used and rejected in ARM
processors.
Features used: 1. Load store architecture
2. Fixed-length 32-bit instructions
3. 3-address instruction formats.
• Bus transaction, BTRAN [1:0], indicates whether the next bus cycle will be
address-only, sequential or non-sequential.
• The address bus, BA[31:O]
• Bus transfer direction, BWRITE.
• Bus protection signals, BPROT[1:0], which indicate instruction or data
fetches and supervisor or user access.
• The transfer size, BSIZE[1:0], specifies a byte, half-word or word
transfer.
• Bus lock, BLOK, allows a master to retain the bus to complete an atomic
read-modify-write transaction.
• The data bus, BD[31:0], used to transmit write data and to receive read
data.
39. What are the signals used by bus slave unit?
A slave unit may process the requested transaction immediately, accepting
write data or issuing read data on BD [31:0], or signals one of the following
responses:
• Bus wait, BWAIT, allows a slave module to insert wait states when it
cannot complete the transaction in the current cycle.
• Bus last, BLAST, allows a slave to terminate a sequential burst to force
the bus master to issue a new bus transaction request to continue.
• Bus error, BERROR, indicates a transaction that cannot be completed.
If the master is a processor it should abort the transfer.
Thumb exit
• An explicit switch back to an ARM instruction stream can be caused by
executing a Thumb BX instruction.
• An implicit return to an ARM instruction stream takes place whenever an
exception is taken, since exception entry is always handled in ARM code.
Differences
• Most Thumb instructions are executed unconditionally.
All ARM instructions are executed conditionally.
• Many Thumb data processing instructions use a 2-address format - the
destination register is the same as one of the source registers. ARM data
processing instructions, with the exception of the 64-bit multiplies, use a
3-address format.)
• Thumb instruction formats are less regular than ARM instruction formats,
as a result of the dense encoding.
Most ARM chips remain strictly neutral in the dispute and can be configured
to work with either memory arrangement, though they default to little-
endian.
18. State the sequence of steps done during a software interrupt arises.
In detail, the processor actions are:
1. Save the address of the instruction after the SWI in r14_svc.
2. Save the CPSR in SPSR_svc.
3. Enter supervisor mode and disable IRQs (but not FIQs) by setting
CPSR[4:0] to 100112andCPSR[7]tol.
4. Set the PC to (08)H and begin executing the instructions there.