ECET 365 Week 5 Homework Assignment
Page 241, Problems 4.1–4.9
4.1 Syntactically, I/O ports are public globals. In order to separate mechanisms from policies (i.e., improve the quality of the software system), how should I/O be actually used?
4.2 Why do we add the volatile qualifier in all I/O port definitions? For example,
#define TCNT *(unsigned short volatile*)(0 0044)
4.3 What happens if an interrupt service routine does not acknowledge or disarm?
4.4 The main program synthesizes data and a periodic output-compare interrupt will output the data separated by a fixed time. A FIFO queue is used to buffer data between a main program (e.g., main program calls Fifo_Put). An output-compare interrupt service routine calls Fifo_Get and actually outputs. Experimental observations show this FIFO is usually empty and has at most three elements. What does it mean? Choose from the following.
4.5 Answer Exercise 4.4 under the condition that the FIFO often becomes full.
4.6 A key wake-up input is armed so that interrupts occur when new data arrives into the 9S12. Consider the situation in which a FIFO queue is used to buffer data between the key wake-up ISR and the main program. The ISR inputs and saves the data by calling Fifo_Put. When the main program wants input, it calls Fifo_Get. Experimental observations show this FIFO is usually empty, and has at most three elements. What does it mean? Choose from the following.
4.7 Answer Exercise 4.6 under the condition that the FIFO often becomes full.
4.8 Consider the following interrupting system. The active-edge inputs on PJ7 and PP7 can occur at any time, including at the same time. The object is to count the number of each type of interrupt.
4.9 Consider the following interrupt service routine. The goal is to measure the elapsed time from one interrupt call to the other. What qualifier do you place in the XX position to make this measurement operational? Choose from volatile static ANS float const or public.