[QUOTE=HenrikOlsson;126443]Hi,
For example, TMR1 is a 16 bit wide counter/timer. It's pretty much setup to be a "tick counter" at start up, all you need to do is enable it
Code:
T1CON.0 = 1   ' Start TMR1
From now on TMR1 will tick at Fosc/4 but you can scale that down by using the prescaler.

OK. So I am starting the clock ticker... How would I pull the current values from it? And then, since I only really need it when the machine is "lost", after my homing process, would it be to my advantage to disable it once finished, or just leave it running?

And I'm not sure what you mean about getting V without doing a lot of math. The math is simple enough... and I don't see how to find V any easier since V is a calculation of time and distance. I would love an easier way if you can show me. This is what I'm doing now...


homeElevation:
serout commout,T4800,"E"
Eencoder0Pos = 0
gosub elUP
pause(250)
if Eencoder0Pos = 0 then gosub moveerror
done = 0
Do
serin commin,T4800,cereal
if cereal = "*" then goto abort
Enewposition = Eencoder0Pos
newtime = millis()
if Enewposition > Eoldposition then Enewvel = (Enewposition-Eoldposition) * 1000 /(newtime-oldtime)
if Eoldposition > Enewposition then Enewvel = (Eoldposition-Enewposition) * 1000 /(newtime-oldtime)
Eoldposition = Enewposition
oldtime = newtime

if Enewvel < .5*Eoldvel then
gosub allSTOP
Eencoder0Pos = 3665
gosub elDN
do
serin commin,T4800,cereal
if cereal = "*" then goto abort
if Eencoder0Pos =< elHOMEpos then
gosub allSTOP
done = 1
exit
endif
pause(250)
loop
endif
if(Enewvel > .5*Eoldvel) then Eoldvel = Enewvel
if done = 1 then exit
loop
return