Mister_e you are my hero!!
That was the problem, I wasn't using variables. I originally had it trying to divide by 3,000,000 but thought I might be over-flowing for some reason, and tried it at 300,000.
DIV32 was taking the last calculation using variables (rlow + rhigh /10) and therefore dividing rtotal by itself.. which was giving me a 1 while running, and a 0 while off...
All makes sense now really..
Just for interests sake, code now looks like
Thankyou very much, many hours were wasted over that.Code:a = 50 b = 60000 ... PULSIN PORTD.6,1,rlow PULSIN PORTD.6,0,rhigh rtotal = rlow + rhigh tbase = a * b rpm = div32 rtotal if rpm = 65535 then rpm = 0 endif
Now that I have it conquered, I will learn more about timers and interrupts.




Bookmarks