I just read this blog post by Mark H and thought that it's a great idea to share it with everyone.
Remember way back when you were learning about voltage and current sources, you were told it was bad to put voltages sources in parallel and current sources in series. These are good rules, but often a voltage source is not exactly and “idea” voltage source. Take the PSoC 3/5 VDACs. At first glance they seem like a typical voltage source and you would never think about putting them in parallel. If you look under the hood, you will find that this voltage source is really a current source with a resistor. When the VDAC range is selected to be 1 volt, it is equivalent to an IDAC in the 256uA range with a 4K resistor connected between the output and Vss.
So you might say “so what?” This means we can actually put two VDACs in parallel and not violate the law of parallel voltage sources. In the diagram below you can see that two parallel VDACs in parallel really look like a single IDAC with double the current output with a 2K load to Vss. The 2K resistor is the result of two 4K resistors in parallel.
If each of the VDACs (VDAC8_1 and VDAC8_2) generate a separate waveform and the VDAC outputs are connected, we simply get the average of those two signals. Take a look at the scope image below where the two upper traces are the two individual VDAC output. The third signal on the bottom is the output of these two signals when the DACs are connected in parallel.
Just to have a bit more fun, do you remember when you learned about Fourier series? I remember how cool I thought it was the first time we looked at the FFT of a square wave and learned the relationship of the harmonics to input square wave. Looking at just the first four harmonics we get the equation below.
We then had to write a program to prove this and display it graphically. With PSoC you can prove it just by connecting four VDAC8s in parallel. As you can see in the image below, the upper four sine waves are averaged together to create the pseudo square at the bottom. Wish I had a PSoC back in school about 30 years ago.
This is just a handy trick when you need to average two or more individual signals in hardware and don’t want to use any external components.
VDACs can be used to generate periodic waveforms by making use of RAM/ROM lookup tables that are transferred to the VDAC either with the CPU or with DMA.