PDA

View Full Version : ELAPSED.PBP modification question



Tobias
- 24th December 2009, 01:52
Can I change the interrupt hertz from 100 to 1000 and then have 0.001 resolution?

Darrel Taylor
- 24th December 2009, 20:55
You can.

You would need to change the TimerConst so that it interrupts at 1khz.
You can use mister-e's calculator for that.

Change the Ticks variable to a WORD.

Then in the ClockCount routine, change to this ...
Ticks = Ticks + 1
if Ticks = 1000 then
Ticks = 0
Seconds = Seconds + 1
; etc.


Happy Holiday's,

Tobias
- 24th December 2009, 21:37
Great. I downloaded the calculator and am using the 'timer helper' module. I am using a 20 Mhz OSC. I am not too sure as to what I need for a reload number. I enter in 1 Khz for the interrupt frequency. Using 10 for the reload number I get 60546 for the preload result. Hex is then ec82. If this correct? I am going to reverse engineer using your numbers for 0.01 resolution to see if its right. I am at the in-laws without my scope so I can't check this today.
Thanks for the help
Toby

Tobias
- 24th December 2009, 21:42
I better clarify, I am using Elapsed-18.pbp if it matters.

Darrel Taylor
- 25th December 2009, 00:35
Very good. http://www.picbasic.co.uk/forum/images/icons/icon14.gif

Elapsed-18 uses an 8-instruction reload.
So, 60544 (EC80) should be a little more accurate.

Can't help with the in-laws ... Sorry. :p
<br>