Robert Rowlands wrote: > > I've attached my interrupt routines. to this email message The comments say it is a frequency meter? > 4Mhz timer = 0.00000025sec per instruction No, not .25 microseconds, but one microsecond. Four clock cycles per instruction, four clock cycles per TMR0 increment. > tmptime counter value after 1.476 sec delay = 5904000 dec = 5A1680 hex > (32 bits wide) Looks like 24 bits to me. Where did you get 32 bits? > So I would need a 32 bit counter to increment up that high. How would > I create a 32 bit counter, Increment a byte. If it overflows, increment the next byte, and so on, until you run out of bytes. > is the code for incrementing the counter correct ??. What code? > circumference = 2.05 > time = tmptime + tmr0 (this is done on every external interrupt) > delay = time * 0.00000025 > mps = circumference / delay > speed = delay * 3.6 Apply algebraic reduction to your formulae and you may find it easier to program. Express the formulae as a single formula in terms of the result, and reduce any superfluous constants. Dave VanHorn suggested a slower clock. I think that may have advantages. Also, you sent your message twice. I guess you received a rejection message and assumed that hitting it harder would fix it. -- James Cameron (cameron@stl.dec.com) OpenVMS, Linux, Firewalls, Software Engineering, CGI, HTTP, X, C, FORTH, COBOL, BASIC, DCL, csh, bash, ksh, sh, Electronics, Microcontrollers, Disability Engineering, Netrek, Bicycles, Pedant, Farming, Home Control, Remote Area Power, Greek Scholar, Tenor Vocalist, Church Sound, Husband. "Specialisation is for insects." -- Robert Heinlein.