Write a program that uses external interrupt #0, #1, and #5. Set up INT0 to sense any
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 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? ______________
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang