First page Back Continue Last page Overview Graphics
Using the previous delay loop, what count is required to implement a 0.14 millisecond delay? Assume a 16-MHz crystal.
First determine how many clock cycles are needed.
Answer: (0.14e-3)/(125e-9) = 1120.
2 + 4x + 2 = 1120 ==> x = 279.
Loop starts by decrementing the count so need LDX #280.
To determine the number of clock cycles needed, divide the total delay time by the delay time for each clock cycle. Once the number of required clock cycles is determined, solve for the loop count in the equation below.
1 * (2) + (Loop Count - 1) * (1 + 3) + 1 * (1 + 1) = # Clock Cycles