Use an LED for initial testing, make blinky first, otherwise, I'll bet you'll drive yourself crazy trying to get it to work right.
One 'easy-ish' way to get it to work...
Set up timer 0 to interrupt on overflow, get an 'On Interrupt' stub to work blinking an LED. Change the Tmr0 prescaler to 1:64. You'll get an interrupt every 16.384ms instead of 10ms. Yes, it's a bit longer than what you want, but you can easily scale the results from the 16.384ms interrupt to make them look like the results from a 10ms interrupt.
16384/10000 = 1.6384.
No, PBP can't divide by a fractional number...but, you multiply it up by a large number and divide it back down by a whole number, keeping the ratio the same to keep the numbers correct...i.e.
16384/10000 = 1.6384 which is the same as
32768/20000 = 1.6384 which is the same as...and so on and so on...
Or, set up Tmr1 as a 16 bit timer that kicks off every 10ms...just like the other guys said...
But $20 says you're biggest problem will be understanding how to get the interrupt to work in the first place...
Bookmarks