On 01-Feb-02 M. Adam Davis wrote: > Thanks for the tips. It is true that since the timer registers are only > so large you can only get so much resolution out of them, and that there > are ways to get around that with external circuitry. > > But if you don't use the prescalar and the frequency is not too high > (<<50MHz) then you can have the more accurate count with a tradeoff of > frequency range. > > Why stop the timer, btw? Reads do not (read: should) affect the count. Oh ... I've been there, read the book, seen the movie, bought the DVD etc... > Read the low byte into W, put it into another register, then get the > high byte - the counter can't go fast enough to increment the high byte > by the time it executes 3 instructions - and the interrupt latency could > even be accounted for... Indeed thats what I thort when I started to develope the code that I posted yesterday.... BUT.... I don't work that way! Despite what it says in the data sheet. Look at 80051c.pdf PIC16F87X Rev. B5 Silicon Errata Sheet. I quote.... "Module: TMR1 When operating in external clock mode (TMR1CS is set), reading either of timer 1 registers (TMR1H or TMR1L) may cause the timer notto increment as expected. .... Work Around Do not read either the TMR1H or the TMR1L registers when operating in external clock mode. " I saw exactly this behaviour which caused a wrong frequency measurement to be displayed. It happened just that little bit too often to ignore ! I think my solution is quite simple and uses TMR0 to avoid the use of complex (= hard to work out the correct loop counters) timing loops to time the frequency count period. Peter. ---------------------------------- E-Mail: Peter Onion Date: 01-Feb-02 Time: 10:24:32 This message was sent by XFMail ---------------------------------- -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads