A 5V logic coompatible falling-edge-triggered Toggle-Flip-Flop using a single active component (a comparator). The idea was derived from a pen-clicker... and, it works!
I needed a T-Flip-Flop for my project #Floppy-bird , and didn't have any TTL components on-hand, so I thought I'd see if it was possible with comparators...
A fellow 'round here has done some interesting stuff with diodes as transistors, and such-like that seems otherwise uncommon, if not "impossible", so inspired by @Ted Yapo, I ventured into the realm of doing-so with only a single comparator. The idea, then, was maybe it'd eventually be possible with a single Transistor...
Then both PWM edges are converted to falling-edge pulses.
This, then, could be fed directly into a floppy drive's "write data" input, storing the PWM on-disk.
When read-back from the disk, the floppy drive will give these same falling-edge pulses to indicate each edge of the recorded PWM.
That, then, gets fed into my single-comparator T-Flip-Flop, to convert those falling-edges back into PWM, then directly drives a speaker.
Ahh, right... So, this video was recorded months ago... long before I ran the 500KHz simulations. I can't recall the frequency this is running at, but it's surely slower than 500KHz, otherwise, as my conclusions, after running the sims... concluded... This system probably won't run at 500KHz, with the LM311's I used.
R1-4 are two voltage-dividers to bias Vi+ at 4V and Vi- at 3V. Thus, when the comparator is off and no toggling occurs at the input, the comparator's output is high (well, the LM311 is open-collector/Hi-Z... and, confusingly, I've the habit of calling it "off" when Vi+ > Vi-, and "on" when the output is low).
So... it remains "off" as-biased... 4V > 3V.
A pull-up resistor is not shown on the output... but it's unnecessary for this circuit, only for those following,
D1 and D2 isolate the output's feedback-paths to Vi+ and Vi-, so's we don't have to consider each's present voltage on the other (especially when the output is Hi-Z).
R7 and the Zener diode form a crude voltage-regulator. Thus, when the comparator output is low, Vi+ will be pulled to ~1V.
When the comparator is on, the zener also prevents the next falling-edge input from dropping Vi+ lower than Vi-. It essentially keeps Vi+ from seeing that falling edge.
(I imagine the zener could be replaced with cleverer resistor usage, but... Math! I'm not so great with analog circuits, it always seems every 'building-block' thrown in has a dramatic effect on all the others. Here, I'm attempting to reduce that effect. Thus diodes, and AC-coupling.)
So, now, Vi+ has two steady-states; 3V and 1V.
The feedback-path for Vi- is slightly more complicated. R9 and C3 limit the rate that Vi- is affected by the comparator's turning on (and off). Similarly, R8 and, again, C3 cause input-edges to be smoothed slightly before entering Vi-.
Thus, the comparator turns on, latching Vi+ low when the present value of Vi+ is lower than the *previous* value of Vi-.
(But wait! That's wrong! So it *does* still function as I originally planned, the spike on Vi+ is larger than that on Vi-, but still simultaneous, so they cross... huh. No.. wait, these don't even look the same. Sheeit. Now I remember why a short lab-report always took HOURS longer than seemingly anyone else's took them.)
But, again, Vi+ essentially doesn't see the next falling-edge, so that slight delay from C3 doesn't stop that edge from bringing Vi- below the steady Vi+, turning the comparator off, again.
Now, as for the rising-edges on the input...
If the two paths were identical, both inputs would rise, briefly, together, and so wouldn't cross-over. Thus, there'd be no change as far as the comparator is concerned...
But of course, the two paths differ (otherwise the same would be true for falling edges, and nothing would happen, ever). So... I didn't really put a huge amount of thought into the rising edge... Instead, some early values for R8 and 9 led to the "on" steady-state voltages for Vi+ and Vi- to be "too close for comfort", so I tweaked those values so that Vi- would be dramatically lower, in that state... nearly half a volt. R6 was initially chosen to be higher than R5 so that the spikes on Vi- would be smaller than those on Vi+, but this is where the progression led me, during simulation.
(BTW, when I was in school, running a simulation meant setting up the circuit, clicking 'run' and waiting several minutes. Now it's possible to do sims in 'real-time', wherein you can change component values while simulating. Very handy.)
Here were my original proof-of-concept component choices:
And, again, those after experimenting:
(It may be possible to remove the feedback path to Vi-, altogether. The...