Perhaps I am not reading the input capture section for the s12p correctly. I cannot find the delaycount register. Does it not exist on the p version? This makes no sense-how can noise be filtered out say, if one was to connect the input capture pin to a camshaft or crankshaft sensor? Even with external filtering on this pin I have always seen noise and used the delay count to filter it out. Wasn't this derivative designed specifically for the small engine market?
S. Prince
sprince wrote: this makes no sense-how can noise be filtered out say, if one was to connect the input capture pin to a camshaft or crankshaft sensor?
You can still filter out noise via software. Use input capture to detect a rising edge and then check the pin a little bit after that to see if the pin is still high.
ECT_EnableInputCapture(0, RISING_EDGES);...void interrupt TC0Handler(void){ if(TC0IsInInputCaptureMode()){ //switch to output compare mode to wait a while TC0 = TCNT + SOME_DELAY; ECT_EnableOutputCompare(0); } else{ if(PTT_PTT0){ //if pin still high PulseCount++; //got true pulse, not noise } //switch back to input capture to detect rising edges ECT_EnableInputCapture(0, RISING_EDGES); }}
Or something like that.