TIMER1 Newbie Question

Aug 08, 2006 1 Replies

Hi,



Although I have Googled TIMER1 info. on MicroChip devices, as a novice, I am somewhat confused and would appreciate a little help.



I have a project I am developing where I wish to count the number of pulses from a 1 MHz square wave source. (I am measuring the time a light beam has been broken)



Now, the 16 bits of Timer1 will allow me to count up to 65535 pulses, which at 1 MHz should give me a window of around a 1/15th of a second. That is good enough for me, as the light beam will be broken by a small, quite a fast moving object - around 5 metres per sec and the object is only 40 mm long - I figure around 1/125th of a second to pass through the beam.



HOWEVER, I cannot for the life of me figure out what I am supposed to be doing with Timer1 and which pin I connect the external pulse to.



Any pointers, tips regarding Timer1 and/or code for initialising/reading it will be great? I have a feeling I should be using Timer1 in Asynchronous Counter Mode - is that correct?



Cap'n Ahab



T1CKI see pinout for the device your using

see reference manual DS33023 Example 12-2 and 12-3.

I have a feeling I should be

Correct

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required