Pages created and updated by 
Terry Sturtevant 
	 Date Posted: 
	 
	 May 12, 2017
	 
	 
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.

 
	 
	 
 

Wilfrid Laurier University
© 2019 Wilfrid Laurier University