Hi Jinx See comments below Phillip Things should be as simple as possible but no simpler Phillip Coiner CTO, GPS Source, Inc. Your source for quality GNSS Networking Solutions and Design Services, Now! -----Original Message----- From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf Of Jinx Sent: Saturday, May 26, 2007 4:45 PM To: Microcontroller discussion list - Public. Subject: Re: [PIC] PIC18F-timing using lasers > In theory it is just a clock but it needs to be able to count time > very accurately. We were thinking to add an external clock to > make it more sensitive. We need to be able to count down to > 0.0001 sec Example : 100.0kph => 27.7778 m/s => 2.7778mm per 0.0001s (100us) 100.1kph => 27.8055 m/s => 2.7805mm per 0.0001s If the timing lasers were 10m apart, using 0.0001s resolution 10m @ 100.0kph = 0.3599s 10m @ 100.1kph = 0.3596s 0.0003s difference => 3 * 100us So you'd be able to differentiate between 100.0 and 100.1, but it's very close at 10m and 100us slice Using a 40MHz 18F you've got a 250ns time slice, or 400 times finer than 100us. An external clock will not be necessary. CCP module would be the way to go If all went well, using 250ns (0.00000025s) resolution 10m @ 100.0kph = 0.36000000s 10m @ 100.1kph = 0.35964035s 0.00035965s difference => 1439 * 250ns Putting the lasers further apart would help, however, finer resolution and longer connections brings its own problems Propagation (wire time, sensors reaction time etc) of signals from lasers to the PIC for example, but they can be calculated and factored out. Micro-fluctuations in speed, maybe not so important or even avoidable [Phillip says] Seems to me that if the propagation time for each sensor was the same/equal i.e. the sensors were made with the same type devices and you used the same amount of wire etc. the propagation time would not matter because you only care about the difference between the two times from when it breaks the first sensor's path till it breaks the second sensor's path. But I suppose that there is no guarantee that the devices would have exact same propagation delay (data sheet anyone?) and the last time I tried to make phase matched cables in the L band it took the best out of seven attempts to get less than one degree difference/error. With a good set-up under controlled conditions, you should be able to do speed measurement quite well. At 100m you could add another kph decimal place with some confidence -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist