Using Teensy 3.2 to delay an analog signal

Status
Not open for further replies.

Tamseel

New member
Hello,

I am a beginner in Microcontroller programming and wasn't sure how I should address the below issue I was having.

I am trying to use the Teensy 3.2 to continuously read an analog signal being fed to an analog pin using the analogReadContinous() statement, store it in an array of length 100 (which gives me a delay of roughly 100us) and then feed this array to the DAC using the analogWrite() statement so it can output this on pin A14. So essentially, I want to continuously sample the analog signal coming in from a function generator or other source (via ADC), save the samples (causing a certain delay), output the samples (DAC).

When I run the code attached, I don't get a clean signal out using the DAC. Is this due to the DAC speed? If so, how can I improve the DAC speed? I read a few forums on using DMA with DAC, would that be the way to go about it?

Basically, I am just trying to build a fast analog read, do some computation or delay the digital samples and fast analog write. Any help or guidance would be greatly appreciated.

Thank you so much for your help!
 

Attachments

  • ADC_DAC_delay_teensy_test.ino
    1.2 KB · Views: 35
Use the audio library!

Here's a 31 tutorial.

https://www.pjrc.com/store/audio_tutorial_kit.html

You can probably skip a lot of this material. Read the first part of section 2 so you understand how to use the design tool, then skip to the part about delay and echo.

The tutorial and most examples use the audio shield. But once you understand how to use the design tool, it's a pretty simple matter to just connect the ADC and DAC rather than I2S.
 
Status
Not open for further replies.
Back
Top