func main() dim retvalue starttimer(0) pauseus 500 retvalue = readtimer() print "Pause took ",retvalue,"ns" retvalue = readtimer() print "print took ",retvalue,"ns" endfunc func starttimer() 'Setup timer 0 T0CON = 0 T0CON.bit(3)= 1 'No prescale' Fastest operation 'When writing to the timer register alwasy write the high byte first TMR0H=0 TMR0L=0 T0CON.bit(7) = 1 'Turn timer on endfunc func readtimer() dim timervalue 'When reading timer register always read the low byte first timervalue.byte(0) = TMR0L timervalue.byte(1) = TMR0H 'Resset the timer TMR0H=0 TMR0L=0 exit timervalue endfunc