Log in

View Full Version : Counting Troubles



mungam753
- 27th September 2005, 04:10
I am trying to build a program that uses the count function on a pin of a 16f877A pic. The program must count to a number around 150,000 and with the 16 bit limit I know this is impossible. I have the program counting for one second before looping and adding the counts to CountTotal. In the end I would like to make it a number between 0 and 15,000. I am just having trouble wrapping my brain around an easy way of doing this. I have thought about taking the counts and dividing it by 10 and adding it to a countsTotal and taking the remainder and making it the starting number for counts on the next loop. If someone can show me a more efficient way of doing the math it would be much appreciated.

Darrel Taylor
- 27th September 2005, 05:07
Hi mungam753,

Here's one way...

32-bit Variables and DIV32, Hourmeter 99999.9
http://www.picbasic.co.uk/forum/showthread.php?t=1942
<br>