Zero-crossing detector

Started by jlvorona March 26, 2004
Hi,

I was wondering how to create a zero-crossing detector with
MC9S12DP256 micro. Thanks for your input.



In a message dated 3/26/04 2:08:28 PM Eastern Standard Time,
writes:

I was wondering how to create a zero-crossing detector with
MC9S12DP256 micro. Thanks for your input.
===========
I assume your analog signal goes to the a/d converter, and its biased so
that the 'zero' is really 2.5 volts, 0x1ff out of 0x3ff. Algorithm: take a
sample. Sample this pass >0 and sample last pass <0? Yes: record sample number of
zero crossing. Sample last pass=sample this pass.