View Single Post
  #1   Report Post  
Posted to alt.binaries.schematics.electronic
John Fields John Fields is offline
external usenet poster
 
Posts: 2,022
Default Pretty accurate zero-crossing detector, just for fun.

Needs a little work, but the concept is that the mains is full-wave
rectified and compared with a reference. On the downward slope, when
the mains-derived signal crosses the reference, the counters are
enabled and a single RESET pulse generated and sent to the up counter,
clearing it. It then counts clocks until the mains derived signal goes
to zero and starts rising again, and when it crosses the reference
this time the counters are disabled and a single pulse generated which
broadside loads the Q outputs of the up counter into the D inputs of
the down counter, but shifted one bit to the right, (MSB to the left)
with the result being that a quantity with a magnitude half that of
the up counters contents will be loaded into the down counter.

Now, when the mains signal peaks and starts falling again, it will
again intercept the reference.

When it does, the counters will be enabled, the up counter will be
cleared and will start incrementing again, and the down counter will
start decrementing until it gets to zero, when a single pulse will be
generated.

Since the quantity loaded into the down counter was half of the
quantity accumulated by the up counter between the two excursions
across the reference, then it would take the down counter half that
time to time out, and the pulse generated at timeout should be located
precisely at the zero crossings of the mains cycles.

Well, within 10 microseconds anyway... :-)

It takes a few minutes for the sim to run, but I think you'll enjoy
it. :-)

BTW, copy all the files into a single folder and then click on the
..asc file to run it. LTspice should find it and launch it.


--
JF