Abadi alali
Active member
I am using the teensy 3.6 and I need to sample 2 signals at the same time to get the phase and amplitude of each, and I am having the following problems:
- There is a 1 micro sec delay in the sampling period, so for example if I set it to 1 micro which gives me 1 MHz sampling rate the ADC sometimes takes an extra micro sec to give the results which misses up my sampling rate. I tried making the sampling rate higher but I am still getting the same one mico sec error (note I am measuring the time using elapsedMicros)
- The synced mode is giving me a maximum sampling rate of 200 kHz, is that the limit?!
- what is the maximum sampling frequency for these ADC models I couldn't find that anywhere.
Thanks for your help.
Note: I am using the examples provided with the library and just adding the time previewing.
This is my code for the synced mode (this is the part in the loop function while the rest is left as it is in the example with setting bot ADCs to 16 bit on Very_hight_speed sampling and conversion:
for (int i=0;i<=1025;i++)
{
result = adc->analogSynchronizedRead(readPin, readPin2);
t=time;
value = (uint16_t)result.result_adc0;
value1 = (uint16_t)result.result_adc1;
}
for (int i=1;i<=1025;i++)
{
Serial.print(t, DEC);
Serial.print(" ");
Serial.print(value*3.3/adc->getMaxValue(ADC_0), DEC);
Serial.print(" ");
Serial.println(value1*3.3/adc->getMaxValue(ADC_1), DEC);
//delayMicroseconds(100);
}
}
}
- There is a 1 micro sec delay in the sampling period, so for example if I set it to 1 micro which gives me 1 MHz sampling rate the ADC sometimes takes an extra micro sec to give the results which misses up my sampling rate. I tried making the sampling rate higher but I am still getting the same one mico sec error (note I am measuring the time using elapsedMicros)
- The synced mode is giving me a maximum sampling rate of 200 kHz, is that the limit?!
- what is the maximum sampling frequency for these ADC models I couldn't find that anywhere.
Thanks for your help.
Note: I am using the examples provided with the library and just adding the time previewing.
This is my code for the synced mode (this is the part in the loop function while the rest is left as it is in the example with setting bot ADCs to 16 bit on Very_hight_speed sampling and conversion:
for (int i=0;i<=1025;i++)
{
result = adc->analogSynchronizedRead(readPin, readPin2);
t=time;
value = (uint16_t)result.result_adc0;
value1 = (uint16_t)result.result_adc1;
}
for (int i=1;i<=1025;i++)
{
Serial.print(t, DEC);
Serial.print(" ");
Serial.print(value*3.3/adc->getMaxValue(ADC_0), DEC);
Serial.print(" ");
Serial.println(value1*3.3/adc->getMaxValue(ADC_1), DEC);
//delayMicroseconds(100);
}
}
}
Last edited: