Boost your Grades with us today!



Discuss the tradeoffs associated with interrupts and polling (described in Section 19.4.1 on page 775).


Section 19.4.1


The printer example given on page 769 explains how a typical programmed I/O operates. The heart of programmed I/O is a busy-wait loop. The processor busy-waits until a specific condition is satisfied, such as the printer “not busy” condition. This process is called polling.

    We use the keyboard to illustrate how the programmed I/O works. We have already presented most of the details we need to write the keyboard program. Program 19.1 shows the program to read keys from the keyboard. Pressing the ESC key terminates the program.

    The logic of the program is simple. To read a key, all we have to do is to wait for the PA7 bit to go low to indicate that a key is depressed (lines 34 to 36). Once we know that a key is down, we read the key scan code from PA6 to PA0 (line 38). The and statement on line 38 masks the most significant bit. Next we have to translate the scan code into the corresponding ASCII value. This translation is done by the xlat instruction on line 41. The xlat instruction usesthe lcase_table translation table given on lines 17 to 23.

    After the key’s ASCII value is displayed (line 47), we wait until the key is released. This loop is implemented by instructions on lines 50 to 53. Once the key is up, we clear the keyboard buffer using an interrupt service (lines 56 to 57). For now, ignore these two lines of code. We discuss these interrupt services in the next chapter.





15% off for this assignment.

Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!

Why US?

100% Confidentiality

Information about customers is confidential and never disclosed to third parties.

Timely Delivery

No missed deadlines – 97% of assignments are completed in time.

Original Writing

We complete all papers from scratch. You can get a plagiarism report.

Money Back

If you are convinced that our writer has not followed your requirements, feel free to ask for a refund.