So I'm wanting to have an audio switch that only actually switches at a zero crossing point (or very near to zero)...this will only involve audio upto about 1.5khz in frequency.
My thinking here is to use a PIC's comparator ....ie toggling when zero points are 'crossed' (this will be a single supply circuit, 'zero' will actually be about 1/2 VCC), but how do I implement the associated code?
At a high level, I reckon it'd be something along these lines...
1. A switch is pressed
2. wait until the comparator's output logic level is *not* what it was at the time of the switch being pressed (ie a zero cross has happened)
3. raise the necessay control voltage to invoke the actual audio switch.
.....now steps 1 & 3 I'm ok with, but how in code would I do step 2? Upon the switch being pressed, the comparator's output could either be high or low (it'd be random), I want to 'trap' quickly the opposite condition of what it is at the time of the switch being pressed.
Ideas?
Bookmarks