hi all
i have developed a timer formulae for lpc series:
((PR+1)*(MR-1))/pclk = time
say for example i want a delay for 1ms than my delay routine will initialise
if pclk=12Mhz
the multiplication (PR+1)*(MR-1)) should at last equal to 12000
so i can choose
1. PR=0 and MR=11999
or
2.PR=11 and MR=1001
so my question is:
1. Am i correct at acheiving this formulae
2. Will the accuracy be equal in both the cases(say in both cases will i get
1ms accurate)
Well, don't know about your knowledge in regards to ARM but your math lags a little.
if you use your example 1, I get a result of 11998 / 12exp6, that is less than 1 ms.
pclk is by default cclk/4 just in case you did not notice this in the manual. May be it is just me, but I do not really understand what the formula is good for.
Bob
hi bob
thanks for pointing out the mistake.
the correct one is :
((PR+1)*(MR+1))/pclk = time
i have implemented this formulae and checked on oscilloscope and found out it is correct upto the level of 100usec.
but the problem is beyond that level i am incorrect.
take the case of 10usec.
i select PR as 14 and MR as 7 and i found the delay is 14usec instead of required 10usec.
does this depend on setting of PR and MR(say reducing one and increasing other)