Question : Calculating the correct delay of clock cycles.

Hello,

I'm really not sure I'm getting this correct, so if somebody could give me a hand it would be nice.

I've got a main clock running at 16MHZ (4,000,000).
An instruction clock is 4 main clocks - so the instruction clock run 4x as slow as the main clock.

I'm wanting to delay for X ms, how do I work out how many instruction clocks that is?

Thank you,
Uni

Answer : Calculating the correct delay of clock cycles.

I believe, that you would divide 1 by the instruction clock, (in this case giving 250nS). therefore one instruction takes approx 250nS. then divide your required delay XmS by 250nS to give required number of instructions to complete the delay.
i.e for a 250mS delay you would require (0.250/0.00000025) 1 million instructions
Random Solutions  
 
programming4us programming4us