I need to count pulses over a long period of time for my stepper motor project. My frequency range is 1hz to 5Khz. I am micro stepping my motor as slow as 1/8th or 1600 steps per rev. However that resolution is more than I need so I was thinking of counting only every x pulses. I estimated that over the entire range of movement I may need a 24 bit variable. (600,000 pulses every 1" of linear movement and I need 3 inches) The duration of counting may be hours to days so I did not think I could use the count command limited to 65 seconds. I know I will have to make some rollover flag for the last 8 bits of 24. I am using the 40x1 at 4mhz.
What can I do to accumulate pulses in to a variable?
What can I do to accumulate pulses in to a variable?