hi fellows,
this is a shorter and clearer way to expose my question:
Does any Interrupt or Timer variable let me capture elapsed time ?
[modified code taken from mister_e post]
Code:Start: TMR1L=0 ' Clear Counter TMR1H=0 ' Clear Counter ' TMR1ON=1 ' START counter ...DO_THINGS ' <----Do other things in unknown time while counting in background ...FOR..NEXT...LCDOUT.... ' ....things happen hserout pulseRATE TMR1ON=0 ' STOP counter ' CounterA.HIGHBYTE=TMR1H ' Get results CounterA.LOWBYTE=TMR1L ' LapTIME = ELAPSED_TIME ' Get ms <---- Something like this is what I wish... does it exist? 'so I can do the following: pulseRATE = CounterA / LapTIME ' this would be heaven... :) [pseudocode] 'pulseRATE is the pulse rate in this cycle. ' ' Blah blah blah ' goto start
The idea is to handle a sort of variable (LapTIME) that handles the elapsed time(ms) while TMR1ON=1 (between START and STOP). to make accurate calculations like pulse rate, speed.. (for quadrature encoders)
well, that is it
thanks for your time
regards,
RodSTAR
Bookmarks