It is desired to create a 2 Hz pulse on PORTB.5. A nested loop was produced to create the delay. Why were the numbers 250 and 39 chosen? What frequency does the author assume? How is the number 25.6 microseconds determined? In this problem, calculate what percentage overhead the author assumes? Solution for the frequnecy of 2Hz(period of 0.5s) on PORTB, we need to toggle the pin every 0.25s. 0.25s = 250 * 1ms 250 is the largest number using an unsigned char which is rounded. 8-bit timer is used with prescaler of 64. The timer value loaded is 255 i.e., a only 1 tick for the timer to overflow. as mentioned in the calculation the delay is 1(ticks) * 64(prescaler) * 0.4us(the period of CLKO) = 25.6us This indicates the clock used is of period (0.4/4) = 0.1us. and frequency of 10MHz. The overhead in the delay routine is that the instruction to configure the timer0 also consumes some time and should be considered as it gets accumulated over the for loops. to accommodate the overhead the internal for loop count is reduced to 35 from 39. So the actual delay of for loop will be 1ms/35 = 28.57us instead of 25.6. so the percentage of overhead = (28.57 - 25.6)/25.6 = 0.116 = 11.6% .