> Can the Timer1 Module a 16F628 (@4Mhz) be used as a software 16bit counter. Depends what you mean. The clock source is either derived from the instruction clock or an external pin. > I have scanned the last 30000 emails and looked at PICLIST.com but all the > discussion seems to be using it driven via hardware. That was 30,001 emails ago. > I was experimenting with MPLAB and I got TMR1L to rollover to FF when I > decremented TMR1H from FF to 00 but cant repeat the results. I tried all > other combinations but they both appear to behave has 2 separate 8 bit files > when using decf or incf Right. They only act as one 16 bit register when incremented by the hardware, and sometimes in conjunction with the CCP module. I think you can set the timer 1 source to RB6, set up RB6 as an output, then toggle RB6 from software, although I haven't tried this. > I thought perhaps MPLAB does not simulate the TMR1 faithfully. It usually does a pretty good job of these things. > What I am trying to do is see how many 26uS units there are in a ext pulse. > Using 8 bits for counter the max pulse width is 6.6mS. 16bit gives 1690mS. > > I got TMR0 to generate 26uS periods but the overheads involved in context > saving and bank switching did leave much time for anything else. It did > work but not enough time to see if an 8bit counter rolled over and then inc > another counter. > > If Timer1 behaved as a 16bit software counter it would save much in > overheads and be a great solution. Anyone used it this way. It sounds like you are trying to use timer 1 backwards. Let the hardware increment it at a steady rate, and take a snapshot of it at the begginning and end of the period you want to measure. The CCP module in capture mode can help do this very accurately. This is the basis for many frequency measurement type applications. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads