newbie here
i am dealing also with a Time to Digital problem. The best i have so far is around 16ns accuracy with FreqMeasureMulti and this code
// Measure 2 frequencies at the same time!
//FreqMeasureMulti freq1; // tacho counter
FreqMeasureMulti freq1; // IAS counter
void setup() {
Serial.begin(57600);
while (!Serial) ; // wait for Arduino Serial Monitor
delay(10);
Serial.println("FreqMeasureMulti Begin");
delay(10);
freq1.begin(5); // tacho counter pin 6
//freq2.begin(6); // IAS counter pin7
// analogWriteResolution(10);
// timer0.begin(timer0_callback, 1.25);
// pinMode(A21,OUTPUT);
// analogWrite(A21,0);
}
int dim=32000;
elapsedMillis timeout;
unsigned long enc_data[32000]={0};
volatile int16_t t = 0, m=0;
void loop() { // ciclo di calcolo
if (freq1.available()) {
enc_data[t]=freq1.read();
if (t==(dim)) {
for ( m=1; m<=(dim); m=m+1 ) {
// output section
Serial.print(m);
//delay(1);
Serial.print(", ");
Serial.print(freq1.countToNanoseconds(enc_data[m] ));
Serial.println();
}
while(1) { } //stop loop
}
t=t+1;
}
}
Actually i let it log a run and when its done i get measures from serial terminal. My issues are about pushing accuracy and a way to move out data for a real time Time to digital analyzer. For the last i am considerind to build an analog out with MCP4922 while wisely limit the range. Any further advice will be appreciate