How do I access a timer in picbasic?

bradle95

New Member
I am using pbc to try to read a shaft frequency. I have a working counter, but I need to be able to time this. How do I access the wdt? I though that I would use the following...

symbol tmr, 1 'set tmr as variable for register 1 (wdt)
symbol seconds
poke tmr, 0 'set the timer at zero

start:
if trm >= 100 then increment 'maybe not 100, but at a set value
goto start

increment:
second = second + 1 'increment the seconds
poke tmr, 0 'set timer back to zero
goto start 'repeat

end
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…