Hello all!
My first question is simply how i can get a more precise timer than the winAPI GetTickCount? The scenario is as follows, im writing a small proggie for my physics class, its supposed to messure the speed of an object. the program will receive a signal when the "nose" of the object brakes the photocell and another one when the "tail" has passed by. Since the object will be between 1 and 3 cm (0.39 to 1.18 inches) wide and the messurements needs to be quite accurate i will need a timer that counts at least 1/100 milliseconds. hope you got the idea =)!

secondly im wondering if anybody knows a good tutorial or equivalant info on handling the com-ports.
Posted on 2004-01-19 16:59:35 by sluggo
Hi sluggo,

1)You should use RDTSC or QuerryPerformanceCounter API if you need under 1ms accuracy.
(didnt i answered this before ?)

2)Windows OS is not suitable for RealTime operations, at least you should attempt and use an IRQ for the signals and that will most likely require programming a kernel mode driver,

3)COM serial ports are too slow for this kind of under 1ms operations.

Basically serial ports are safer sending data over long cables/wires but they are slow; while paralel ports are faster and for shorter cables/lines.

4)We do not make other's homeworks.

5)If you make progress on your own and get stucked somewhere and/or need general guidance ppl here will most likely help.
Posted on 2004-01-19 17:32:15 by BogdanOntanu
thank you!
and since i enjoy programming asm so much i wouldnt let anybody else do this homework =)!
what im looking for with the com port is not a continous flow of signals but start and stop ones. Do you think the low speed of the port could be make the results differ so much its not neglectable? thank you again for your help!
Posted on 2004-01-19 18:25:26 by sluggo
From Windows I don't think something like WinIO will work because the time measurement itself needs to be done at the driver level. The port generates an interrupt and by the time that signal reaches user level code we have already lost the percision needed.

I strongly suggest Four-F's KMD tut's if you are serious about making the measurement from windows.

OTHO, an accurate solution from DOS should be very easy. Download your favorite TSR proggie with ASM source, gut the meat, insert interrupt code using time stamp counter to measure time between interrupts, and done.
Posted on 2004-01-19 19:22:35 by bitRAKE
Well, you don't say you're an EE student.

If you are an EE student, I would suggest using a microcontroller with a timer/counter and a serial interface. It can send the captured information to the PC in a convenient format.

If you've never used microcontrollers, a DOS system is the next best thing, as bitRAKE suggests.
Posted on 2004-01-19 23:02:25 by tenkey
That being a clean DOS system - not a DOS TSR running under vm86 in windows.
Posted on 2004-01-20 01:38:07 by f0dder