CSE391 - Batch 16
CSE391 - Batch 16
1. (a) Suppose the Code Segment Register has a value 3100 and the Instruction Pointer
Register has a value 1208. What will be the address where the next instruction will be
fetched from? All the numbers are given in hexadecimal format. (5)
(b) Define Computer Bus. What do you understand by an n-bit microprocessor? In a
microprocessor system, the address bus 32-bit wide and the memory is byte addressable.
is used? Discuss its advantage(s) and disadvantage(s) over the other one. (3+3+4=10)
2. (a) What are the advantages of interrupt over polling? What are the steps does the CPU
ADD A, B
. JMP 1996H
-Contd ~:.~~:~.P72--
=2=
CSE 391
Contd ..... Q. No. 3(c)
You have to write the machine code related to the above assembly code in the I MB main
memory of 8086 in tabular form as shown below. The Instruction (right) column should
contain the machine code to be written while the Address (left) column should contain
the address of the main memory where you are writing the corresponding code. Your
table should have row(s) for each of the given 10 assembly instructions. The values of
Code Segment Resister and Data Segment Register are 1800H and 9000H respectively
and both of the segments are 64KB of size. Remember that the memory of 8086 is byte
addressable and the data bus is 16-bit wide. Give a probable value of the variable 'X' of
the 4th assembly instruction and justify your value picking. (lOxl.S+3=18)
Address Instruction
3. (a) Consider that you have configured the ATmega32 ADC with a reference voltage of
the digital values is binary format when the analog input is (2x3=6)
1. 1.7V
2. 3.2V
(c) Consider the following scenario:
You are using a temperature sensor which produces an output voltage of OV to 4V for 0
degree to 100 degree Celsius linearly. The sensor is connected to the ADCO pin of
ATMega32 and you are using a pre scalar of 4. Your setup has two push buttons A and B
which are connected to INTI and INT2 pins, respectively.
Now write a C code to use ADC of ATmega32 MCU in interrupt mode so that when the
button A is pressed, the microcontroller will read the sensor value and determine the
temperature and then dump the temperature value on Port B. Upon pressing the button B,
port B will be reset to the room temperature value (assume to be 25 degree Celcius). keep
in mind that you have to choose the ADC reference voltage in a way so that the precision
is not compromised. The buttons bounce a lot. Do necessary steps in your code so that
debouncing is achieved.
Contd P/3
\
=3=
CSE 391
conk ... Gl. No :seC)
-------
The codes for external interrupt events of INTO and INTI are as following:
The codes for external interrupt events of external INT2 are as following:
(b) Discuss the following data addressing modes with their usage. (3x3=9)
(i) Base-plus-index addressing
(ii) Register relative addressing
(iii) Base-relative-plus-index addressing
(c) Suppose, 8086 is reading data bytes from a type writer through Port A of the 8255
using strobed input mode (mode I). The timing diagram for one byte of data transfer is
given below: -
.INTR
RD
DATAON-<-_ _ )_>- ~ _
PAo -PA7- -----------
4
Figure~25:Ti~i:g Dia:~m for ~lc)_
------------
Now redraw the same timing diagram in your answer script and mark the first occurrence
of each of the following events with the corresponding event ID surrounded by a circle
on the timing diagram. (2x9=18)
Contd P/3
CSE 391
Contd .... Q. No. 4(c)
SECTION -B
Contd P/4
.,:..
..
CSE 391
Contd ..... Q. NO.6
(a) In Smith's design, which switching element should be attached with the alarm? With
proper schematic diagram, discuss the self-repcating characteristics of his chosen
. 7. Andrew Russell is using Raspberry Pi for smartly controlling his home. For this, he needs
to interface ADC0804 to his Pi. ADC0804 is an 8-bit, single channel, parallel output
ADC. But he has only 2 digital I/O pins left for interfacing ADC0804. He is also facing
difficulty to execute his program at startup. He is also annoyed to see a RUl1lime-
Warning, saying something along the lines "channels already in use" whenever he runs
his program more than once.
(a) How can Russell ensure execution of his program at startup? (7)
(b) What is the simple mechanism that Russell can use to interface ADC0804 with his Pi?
8. (a) Briefly describe the concept of channels and pipes in NRF24LOI module. (6)
(b) Is asynchronous communication really asynchronous as the name suggests? If not,
then write down some basic mechanisms that can be undertaken to co-ordinate such
shift registers" - do you agree with this statement. Justify your answer. (10)
(d) Briefly explain the repeated start condition and clock stretching of TWI protocol. (7+7)
(XCKlTO) PBO 1 40 PAD (ADCO)
(T1) PB1 2 39 PA1 (ADC1)
(INT2/AINO) PB2 3 38 PA2 (ADC2)
(OCO/AIN1) PB3 4 37 PA3 (ADC3)
(SS) PB4 5 36 PM (ADC4)
(MOSI) PB5 6 35 PA5 (ADC5)
(MISO) PB6 7 34 PA6 (ADC6)
(SCK) PB7 8 33 PA7 (ADC7)
RESET 9 32 AREF
VCC 10 31 GND
GND 11 30 AVCC
XTAL2 12 29 PC7 (TOSC2)
XTAL1 13 28 PC6 (TOSC1)
(RXD) PDO 14 27 PC5 (TDI)
(TXD) PD1 15 26 PC4 (TDO)
(INTO) PD2 16 25 PC3 (TMS)
(INT1) PD3 17 24 PC2 (TCK)
(OC1B) PD4 18 23 PC1 (SDA)
(OC1A) PD5 19 22 PCO (SCL)
(ICP1) PD6 20 21 PD7 (OC2)
, I
ATMega32 Pin Out for Section i iA
- U
Register
Configuration
Name .
Part1
,
~ ., .. .i
"
:
..
.
:(',i','"
~.. (Rev3)'
~'. . ,,' oa -
.,
~ !'4(S.O~ ,D!lPWM _.
:oi) :~W/:ii~I05r
[)12IMISO ..
!'t3i~K
Nic
~' .
. ,!I.:)
.,
Figurf J'fui~circuit
A.:.....