Im using LPC1778 uC to generate a pulse of 500Hz from the timer interrupt routine. I have configured the interrupt to interrupt every 200uS. It enters the ISR on time. But what i want to know is the accuracy of the keil simulation time shown? Will it vary when actually executed on the hardware.Because the Logic analyser shows a pulse that slightly off than whats expected. How reliable is the logic analyser graph,which depends on the keil sim time shown?
200 * (120000000 / 1000000 -1)
But this is not an N-1 formula.
Your formula gives the value 23800, since you included the -1 inside the parentheses and so multiplied it by 200.
The above would give (23801 / 12000000) = 0.001983 seconds period time. Seems to agree with the logic analyzer output...
Shouldn't you compute:
200 * (120000000 / 1000000) -1
which would give the value 23999.
And 0, 1, 2, ... 23998, 23999, 0, 1, 2, ... represents a series of 24000 values. Hence the N-1 rule.
And an event every 24000 ticks would - if assuming 12MHz input frequency - give 12000000/24000 = 500 events/second or one every 2ms.