Challenge: analog sine/cosine from 4 bit digital angle
Wuerfel_21
Posts: 5,052
Once upon a time, I wondered how hard it'd be to get YPbPr video out of a P1, such that it is compatible with existing NTSC code. You'd set VCFG to VGA mode to get the raw color bytes. The bottom three can go straight through the normal 3 bit DAC into the Y output, but to turn the hue and chroma enable (saturation) bits into Pr/Pb is more complicated... Basically, Pb and Pr are U and V at different amplitudes (because reasons) and U and V are the cartesian equivalent of the chroma phase/amplitude.
Not being an expert on analog electronics, I mucked about in a simulator a bit to figure out a way to generate these signals.
Here's my result.
Uses 8 NPN transistors, 6 diodes, 5 XOR gates, 2 NAND gates, one inverter and a bunch of resistors. (The counter and the inverter on Q6 are just part of the test setup).
In truth, it really generates weird triangles rather than sines, but seems GoodEnough™.
It also doesn't seem to work without the AC coupled output, idk what's up with that (in an actual video application, the cap would be in the 3-digit µF range, I just put 10µF in the simulation so it settles quicker)
I don't really plan on building this anytime soon, I'm just thinking about it for fun.
Anyways, do you have a better circuit idea? (less components, better quality)
The "requirements" are as follows:
- Generate analog sine/cosine from 4 bit angle
- All 16 angles result in distinct output
- Both signals must go to 0 when the saturation bit is low
- Should be able to operate at 5 MHz (SD video bandwidth) under real-world conditions
Not being an expert on analog electronics, I mucked about in a simulator a bit to figure out a way to generate these signals.
Here's my result.
Uses 8 NPN transistors, 6 diodes, 5 XOR gates, 2 NAND gates, one inverter and a bunch of resistors. (The counter and the inverter on Q6 are just part of the test setup).
In truth, it really generates weird triangles rather than sines, but seems GoodEnough™.
It also doesn't seem to work without the AC coupled output, idk what's up with that (in an actual video application, the cap would be in the 3-digit µF range, I just put 10µF in the simulation so it settles quicker)
I don't really plan on building this anytime soon, I'm just thinking about it for fun.
Anyways, do you have a better circuit idea? (less components, better quality)
The "requirements" are as follows:
- Generate analog sine/cosine from 4 bit angle
- All 16 angles result in distinct output
- Both signals must go to 0 when the saturation bit is low
- Should be able to operate at 5 MHz (SD video bandwidth) under real-world conditions