"Continuous mode"

Status
Not open for further replies.

dpmanthei

Member
I've seen mention of "continuous mode" and "continuous measurements" but can't seem to find what it is, why I would want it, or how to use it. I have browsed through the thread at: https://forum.pjrc.com/threads/25532-ADC-library-update-now-with-support-for-Teensy-3-1 but I'm not getting it.

Is there something like the Arduino Reference page for continuous mode and other Teensy-specific functionality?

To provide some background, I have a project in which I have six external waveforms that I wish to measure using my Teensy 3.6. When an interrupt occurs, I want to "look back" at the history of these waveforms and pick some specific points from the array of values for each one. Yes, my life would be much easier if the interrupt signal happened first and I could just start logging data at that point, but the design of these waveforms and signals is not in my control.

At the moment, I'm just using an analogRead in the main loop to constantly write the current measurement into an array after shifting all the existing values first. My concern is that the exact time these values go into the array may not be constant since the number of CPU instructions per loop can change due to a variety of conditional statements. I'd prefer to use modulo and micros() to take a sample every 25 microseconds, but this method seems to miss some measurements based on a side-by-side with my oscilloscope. My goal is to have six buffers/arrays of data to always contain the last 3ms of analog measurements in 25 microsecond increments.

Whether "continuous mode" helps me or not, I'd like to know more about it. Thank you in advance for any explanation.
DPM
 
That thread is the one you are after, the library should be part of your existing teensy install and analogcontinuousread example would be the place to start, noting you need to enter serial commands to kick the continous read process into action.
 
Continuous mode means that the ADC is measuring all the time; that is, it doesn't stop when it gets a result and keeps updating it. Based in your description it's not really what you want.
If you want to take periodic measurements have a look at the pdb or the IntervalTimer examples of the ADC library, then you'll need to use a ring buffer to keep the last N data points.
Measuring 6 signals every 25us will be hard, including putting the data into the buffers, hopefully the impedance is very low so you can use the fastest settings.
 
Status
Not open for further replies.
Back
Top