(c) You are developing a maskable interrupt-based application using PORT H pin P
ID: 2081919 • Letter: #
Question
(c) You are developing a maskable interrupt-based application using PORT H pin PH4. The pertinent interrupt enable and flag registers are noted below: Complete the code fragment below to enable interrupt on pin PH4: DDRH & = ~ 0 times 10;//Make pin PH4 input for external device interrupt PIEH | = 0x;//Enable interrupt on pin PH4 (supply missing value here) asm ("cli");//Enable global interrupt Complete the code fragment below to clear the interrupt flag bit corresponding to pin PH4: PIFH | = 0x;//clear interrupt flag for PH4 (supply missing value here) (d) Cite an example of a "polling" based application that can be converted to an "interrupt" based one to free up the CPU.Explanation / Answer
PIEH |= 0x10 ;
Explanation - We OR the contents of the PIEH register with binary number '0001000' so as to ensure that the rest of the contents of the PIEH register remain unchanged as they are ORed with zero, We know that anything ORed with zero retains its value, i.e., if 1 is ORed with zero, the answer is 1 itself; if 0 is ORed with 0, the answer is 0 itself. On the other hand, we OR the bit position orreponding to pin 4 with 1. We know that anything ORed with 1 gives the answer as 1, Hence, the missing value becomes '00010000' in order to enable interrupt on pin 4.
PIEH |= 0x10
Explanation: The explanation for writing 1 corresponding to the position of pin 4 is similar as above. It is stated in the given information that writing a 1 clears the corresponding flag associated with the pin. Hence, to clear the flag associated with pin 4, we write 1 in its position.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.