Dan Michaels wrote: > > Robert Rolf wrote: > >Drew Vassallo wrote: > >> > >> my timer/counter routines, I always use assembler, because > >> >then I know exactly how many clock cycles everything takes, > >> >and still the overhead is sometimes a problem - but then my routines > >> >use timer1 to measure up to 60 Mhz. > >> > >> How do you measure 60MHz with a PIC? > > > >Very very quickly. > > > >More likely, with an external prescaler. > > > > Actually, I use the "internal" prescaler. With an external prescaler, > ie 74AC74 it can do >150 Mhz [maybe faster, but I don't have anything > goes any faster to feed in]. > > Basically, 16-bit Timer1 fed by the internal prescaler on pin RC0 > responds successfully to signals up to 50-60 Mhz [but not to 80 or 100]. > Use Timer0 to count seconds, or fractions thereof, and another counter > in RAM to keep track of TMR1IF overflows. Note - this does not require > using interrupts, just polling the flag. > > The errors come in, for very fast input frequencies, in terms of the > #times the input changes as related to the overhead of monitoring the > timer flags. In other words, if it takes 2 usec to execute the loop, > during which the input changes 100 times, there is your error. > > Also note --> if you look at the Mchp datasheets regarding risetimes/etc > for Timer1, you will become very confused. Mchp has revised the table > several times since the 1995 databook - so apparently they are not too > sure themselves. When feeding in 60 mhz to RC0-->prescaler-->Timer1, > you are "apparently" violating what the datasheet says, but it sure > works fine. > > - dan michaels Dan, My 16C84 datasheet (page 27) says re using external pulse input, internal prescaler to TIMER0 counter, that the only requirement for the input signal is that the high and low period are each greater than 10nS. So that would be 50MHz. And completely in spec, if I read it right. It was actually talking about using the external clock as the osc, so since there is a lot less timing critical hardware just using it as a TIMER0 counter, 60MHz should be real safe. -Roman -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.