Table Of Contents
Previous Section Next Section

Program 108: Short Time

The programmer needed to create a precise short delay in his program. He discovered that if he did 1,863 multiplies, that would create the correct delay. This fact has been turned into the following subroutine. But in some circumstances, the function fails. Why?

  1 /*************************************************
  2  * bit_delay -- Delay one bit time for           *
  3  *      serial output.                           *
  4  *                                               *
  5  * Note: This function is highly system          *
  6  *      dependent.  If you change the            *
  7  *      processor or clock it will go bad.       *
  8  *************************************************/
  9 void bit_delay(void)
 10 {
 11    int i;      // Loop counter
 12    int result; // Result of the multiply
 13
 14    // We know that 1863 multiplies delay
 15    // the proper amount
 16    for (i = 0; i < 1863; ++i)
 17    {
 18        result = 12 * 34;
 19    }
 20 }

(Next Hint 342. Answer 16.)

Table Of Contents
Previous Section Next Section