Fun deviation into ADC/DAC
frank freedman
Posts: 1,983
Decided to fork off a small experimental branch from the curve tracer project. Te current setup eats about 3 cogs, main control, clock generator and the sample acquisition / storage unit. Thought it would be interesting to take the start stop off and make it continuous capture and export the 12 bit results to the outa pins 08-19. After fighting with the #$#^ or function, I got the bits going out and fed them into an 12 bit R2R DAC patterned after the IKAlogic circuit found on the internet.
The R's are all 200K 2% (fry's/NTE) so R=100K and 2R=200K. I had bought about 100 of them, so picked the values closest to a center average to minimize deviations between steps. the output device is an NTE928S (8dip was not available at the time). Maybe i will make the second op amp in the package a gain stage so that I can get higher output. (Powered by 9V battery for now, could have used the 12V (old wall wart) Vin of my gg usb board as easily)
Here are the results as recorded via o'scope. No surprises for analog hands, but the aliasing effects once nyquist exceeded make a good example of aliasing for those not as familiar with analog sampling systems. It approximates electronically the graph paper excercise in the Caxton Foster book on real-time programming which also seeks to demonstrate the effects of aliasing.
All in a couple of nights fun........
Frank
MCP3201 sampling at 100 ksps, 1.6Mhz sample clock .
R2R DAC
Input freq well below Nyquist
Almost there......
about 53 kHz input output way below that now
The R's are all 200K 2% (fry's/NTE) so R=100K and 2R=200K. I had bought about 100 of them, so picked the values closest to a center average to minimize deviations between steps. the output device is an NTE928S (8dip was not available at the time). Maybe i will make the second op amp in the package a gain stage so that I can get higher output. (Powered by 9V battery for now, could have used the 12V (old wall wart) Vin of my gg usb board as easily)
Here are the results as recorded via o'scope. No surprises for analog hands, but the aliasing effects once nyquist exceeded make a good example of aliasing for those not as familiar with analog sampling systems. It approximates electronically the graph paper excercise in the Caxton Foster book on real-time programming which also seeks to demonstrate the effects of aliasing.
All in a couple of nights fun........
Frank
MCP3201 sampling at 100 ksps, 1.6Mhz sample clock .
R2R DAC
Input freq well below Nyquist
Almost there......
about 53 kHz input output way below that now
Comments
As to the prop and ADC/DAC, I tried to set up the most likely to change parameters to be placed in the con part of the top module and passed through shared memory locations into the individual cog. Feel free to fold, spindle, or mutilate it as you will. If any comments, suggestions or improvements, feel free to let me know. I may or may not decide to use them depending on usefulness, relevance or phase of the moon but will value most comments appropriately. One little discovery was playing with the bit count, and somehow obtained a CSC function from the input sine wave. Not sure why, but with a couple weeks downtime, might figure it out.
Frank
Sorry about the edit, almost forgot. The reason for the modularity comes from the curve tracer. Also, the way it is now, multiple acq modules can be used by adding in the appropriate pin and cog and launching another acq_module for that device.
acq_module.spin
clockgen.spin
adc_master.spin
Ought to be able to store that into an sd card in real time as well.
Do we have any resident FFT experts who might have some ideas regarding add vs multiply vs using the log lookup tables to do a FFT in real time, and if so, at what sort of resolution?
Frank
Still playing with them, I may try passing the samples through another cog to try inline processing. maybe start with log compression since the prop has that built in. I work with digital image subtraction all the time in Angio suites, wonder what the audio equivalent will sound like as well. ...
Time to have more fun. New TI samples have arrived. Some (former Nat Semi) A/D with a higher speed of digitization. I am still learning the intricacies of A/D and D/A. Seeing the effects of sampling frequency and samples per time has been quite interesting to see as opposed to reading the theory behind everything.
Frank