false edge counting on slow ttl signal w/a little noise
northcove
Posts: 49
I am counting positive edges of a relatively slow TTL signal (<50Hz) generated by an anemometer that probably uses an internal Hall effect transistor. The signal rise time is about 5usec. The signal unfortunately contains a bit of higher-frequency noise (~+/-0.05v) which is easily observed on my scope. My spin code works great but there is sufficient noise in the signal that the propeller's fast edge detection also counts noise edges around the low-hi transition voltage (eg. a bit of noise quickly puts the signal high then low during a true rising edge which increments phsa by 2 instead of 1 since the state comparison happens very quickly.) This effect exaggerates the anemometer's speed by about 5%. A hand-written counter which slowly reads the input <100Hz works but I'd prefer to use CTRA instead. Advice on making CTRA posedge counting not falsely trigger by noise is appreciated!
Comments
I want to know if the alignment is bad, and also to correct what I can.
I use 2 counters, one to simply record the (scaled) edge count, the second in level mode to record the time of the transition. I pre-load the counter value with system counter to allow it to time stamp the transition.
At the moment I am just using the timestamps for instantaneous speed. The bit I need to do is to keeping a log of recent timestamps and do some calculation to detect impossible accelerations.
Please start your own thread and include a clear question as part of your "subject". It helps attract attention to your question and it makes it easier for others to find answers to similar problems when they're searching. Your situation with the sensor is something that others may encounter as well and it would be useful for you to describe how you've solved it (when you're done) ... maybe in the Completed Projects forum.
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle