Pages created and updated by Terry Sturtevant Date Posted: May 12, 2017

CP316: Microprocessor Systems and Interfacing

Interrupts Pre- or Post-lab

The tenms timer routine uses a constant called "time_adj" to set the timer for the desired delay. The definition of time_adj includes some magic numbers. One of the magic numbers would be changed if you wanted a delay different than 10ms.
Change the definition of time_adj so that the one magic number mentioned is replaced by a use of assembler math so that a constant, _MS_DELAY, indicates the number of milliseconds of delay required; (for instance, 10), and doesn't require the programmer to remember the conversion factor.
(Even better, since that number is based on the processor speed, create a constant for the processor speed which gets used in the math so that processor speed and delay time can be changed independently.)
You should then change the subroutine name, since it won't always be a ten ms delay anymore. Use a name that makes sense even if the desired delay is changed.

Hand in a copy of this code snippet; you don't need to include the rest of the code.

Creative Commons License

Information on this site which is produced by Terry Sturtevant is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 Canada License.


To view pdf documents, you can download Adobe Acrobat Reader .
get Acrobat Reader
If you need to update a browser, you might try Firefox which is Get Firefox!
Since this page uses cascading style sheets for its layout, it will look best with a browser which supports the specifications as fully as possible.

If you are looking for an office package, with a word processor, spreadsheet, etc., you might try LibreOffice which is Get LibreOffice!

Go to the main page for the Department of Physics and Computer Science.

Valid XHTML 1.1

Valid CSS!

(Level AA)

Wilfrid Laurier University