AnsweredAssumed Answered

7816 Zero-crossing timeout.

Question asked by dBC on Jun 1, 2015
Latest reply on Jun 2, 2015 by dBC

I've got some s/w that I want to sync very approximately with the a zero-crossing on V, so basically I clear ZXV in STATUS1 and wait for it go high again.  Provided there's a nice swing on V it finds the zero-crossing event and proceeds as expected.  I wanted to make it robust in the case when there is no V input, and figured I could use the Zero-crossing timeout feature for that.  So I programmed up ZXTOUT with 480 figuring if I haven't seen one in 30 msecs, it's time to move on.   So now I clear ZXV and ZXTOV in STATUS1 and wait for either of them to come high.  Then I pulled the wire off V, so that there was no substantial signal going in, and tested the code.  I discovered I can easily poll STATUS1 for a full second, and see neither ZXV or ZXTOV.   I tried setting ZXTOUT to a much smaller value, and if I go low enough I do see a ZXTOV event, but I'm getting almost no consistency between the value written to ZXTOUT and the time I have to wait to see a ZXTOV event.


I've attached a picture of the captured raw V waveform data at the time.  With the un-terminated V inputs, it looks like it's picking up some very low-level 50Hz noise from the lab...  always < 3000, and well below the 10% of full-scale threshold required to get ZXV firing. But it feels as if this background noise is enough to keep resetting the zero-crossing timeout countdown back up to ZXTOUT.  It's only by setting ZXTOUT quite low that I have a chance of getting a timeout.  For what it's worth, with this un-terminated input, line frequency and linecyc accumulation are jumping about all over that place, but I've always assumed that's expected behaviour when the device is just seeing noise on the V input.


For now I've stopped using TXTOV and do my own timeout in s/w, which works fine.  But I'm curious.  Should I be able to rely on always getting either a ZXV or ZXTOV event, or is there a big "gap" between the voltage at which ZXVs stop (10% of full-scale) and the voltages at which ZXTOV are permitted to start? v_noise.png