Question: Write a program that uses external interrupt #0, #1, and #5. Set up INT0 to sense any logic change, set up INT1 to sense falling

Write a program that uses external interrupt #0, #1, and #5. Set up INT0 to sense any logic change, set up INT1 to sense falling edges and set up INT5 to sense rising edges. Initialize a counting register (use R22) to hold a result from the Interrupt Service Procedures (ISPs) associated with INT0, 1 and 5. The ISP for INT0 should increment R22. The ISP for INT1 should increment R22. The ISP for INT5 should decrement R22.

INCLUDE

.DEF TEMP=R16

.CSEG ; The start of the code segment

.ORG 0X0000 ; Set the beginning of code at the reset interrupt vector

RJMP MAIN ;jump to main program from the reset interrupt

MAIN:

LDI TEMP, LOW(RAMEND) ; Setup Stack

OUT SPL, TEMP ; Set SPL to the low byte of RAMEND

LDI TEMP, HIGH(RAMEND) ;

OUT SPH, TEMP ; Set SPH to the high byte of RAMEND

;insert code here

LOOP: ; A continuous loop is an essential

; part of any embedded program

;insert code here

RJMP LOOP ; Start the LOOP over

Given an appropriate voltage input signal of 500 Hz and duty cycle of 10% is connected to the inputs for external interrupts #0, #1 and #5 (same signal for all 3), what would the value in R22 after 1 sec? ______________  

Step by Step Solution

3.46 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Answer Question Write a program that uses external interrupt 0 1 and 5 Set up INT0 to sense any logic change set up INT1 to sense falling edges and set up INT5 to sense rising edges Initialize a count... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!