I need to count the ticks from a simple switch attached to a gauge. The time it takes from the first detected tick to the 20th is the important data. To acquire the cycling on and off of the switch i have come up with 2 serial port techniques.
1) use the ready to send voltage through the switch and constantly poll in 10ms intervals the clear to send pin for its value and use that to determine the cycling.
2)loop pins 2 and 3 (- in and out) through the switch, constantly writing a character and using the datarecived event to increment a count. and using a checkcount from a timer to determin the cycling of the switch.
My question is, which one of these would be the best route? obviously (1) is the simplest. But I can't seem to determine which is the most accurate system. I don't have much knowledge of the speed and reliability of Serial Port communications and uses. Any thoughts beyond speculation would be appreciated. I have 2 working solutions. I need the most accurate. I have done testing and I can't see to figure which works best. And although the difference is minute, its important that I use the most accurate and reliable method.