Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

QUIZ-2: Priyesh Pandey, 11640710

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

1

QUIZ-2
Priyesh Pandey , 11640710

Objective a) INT1
Framing the assigned question(no.-29) compati- b) INT0
bly with ATMEGA328p. c) none of them
d) both of them
Original Question
Solution
The time period of a square wave in the audio
frequency range is measured using an 8085 micro- As, mentioned in the question the time period
processor by feeding the square wave to one of the of the square wave is measured using the points
four interrupts, namely, RST 7.5, RST 6.5, RST only where a period starts or ends, therefore the
5.5, or INT. The algorithm used starts a timer at interrupt we require to start the timer should
the beginning of a time period, stops the timer at be edge triggered, in the given microprocessor
the beginning of the next time period and reads interrupts both of them can be used as INT0,INT1
the timer values for time measurement. Which of are both edge triggered and level triggered.
the following interrupts should be selected for this Therefore the answer is c.
application?
a) INTR Question based on CODE
b) RST 6.5
c) RST 5.5 Consider the given code, and mark the correct
d) RST 7.5 option:
a) On using INT1, interrupt ocurs when a rising
Solution edge triggering is occuring.
As, mentioned in the question the time period b) On using INT1, interrupt ocurs when a falling
of the square wave is measured using the points edge triggering is occuring.
only where a period starts or ends, therefore the c) On using INT0, interrupt ocurs when a falling
interrupt we require to start the timer should be edge edge triggering is occuring.
triggered, in the given hardware interrupts only RST d) On using INT0, interrupt ocurs when a level
7.5 is a edge triggered interrupt while the rest are triggering is occuring.
level triggered.
. include " m328Pdef.inc"
Therefore well use RST 7.5 and hence the answer .ORG 0
is d. RJMP MAIN

Framed Question .ORG 0X02; address of INT0 interrupt


;. ORG 0X04; address of INT1 interrupt
The time period of a square wave in the audio JMP TOGGLE
frequency range is measured using an ATMEGA 32
microprocessor by feeding the square wave to one MAIN:
of the two interrupts, namely, INT0 or INT1. The LDI R16 , HIGH( RAMEND )
algorithm used starts a timer at the beginning of a OUT SPH , R16
LDI R16 , LOW( RAMEND )
time period, stops the timer at the beginning of the OUT SPL , R16
next time period and reads the timer values for time LDI R16 ,1<<ISC01 | 1<<ISC00
measurement. Which of the following interrupts ; LDI R16 ,1<<ISC11 | 1<<ISC10
should be selected for this application? sts EICRA , R16
2

;PORTD ,3 for int1


SBI PORTD ,2
LDI R16 ,0 B11111111
OUT DDRB , R16
; for setting int1 use 0x02
LDI R16 , 0X01
OUT EIMSK ,R16
JUMP:
RJMP JUMP

TOGGLE :
LDI R17 ,0 XFF
OUT PORTB ,R17
RCALL DELAY
LDI R17 ,0 X00
OUT PORTB ,R17
RETI

DELAY:
LDI R16 ,0 XFF
L1: LDI R17 ,0 XFF
L2:ldi r18 ,0 X0F
L3:
DEC R18
BRNE L3
DEC R17
BRNE L2
DEC R16
BRNE L1
RET

Solution
From running the code and interfacing with LED
and push button, we can easily observe that rising
edge triggering occurs both at INT1 and INT0.
Hence,the correct answer is a.

You might also like