I am trying to stream continuously, and would like to be able to set the sampling rate, but when I set the interval like:
actual := adc11_set_interval (BUFFER_SIZE * 1000, BUFFER_SIZE, channels, n);
I get samples every 200us, apparently the meaning of the parameters for the adc11_set_interval function has a different meaning for BM_STREAM than it has for BM_WINDOW and BM_SINGLE!
How do I tell that I only want a single reading per sample?
n:=Channels_Count(channels); //n is the same as No_Channels
BUFFER_SIZE:=max_values*n;
//TargetTime:=SampleRate*max_values*No_Channels;
actual := adc11_set_interval (BUFFER_SIZE*1000 , BUFFER_SIZE, channels, n);
// actual := adc11_set_interval (TargetTime, BUFFER_SIZE, channels, n);
adc11_run (BUFFER_SIZE, BM_STREAM);
etc...
If I change the target time or 'BUFFER_SIZE*1000' to be equal to BUFFER_SIZE, that is to reduce the 1000 to 1, I apparently get the samplingrate I would expect, if I use a sleep loop as in your C con example, but the timevalues from the function call:
I have just found out that it actually works if I use the Commentet code like this:
n:=Channels_Count(channels); //n is the same as No_Channels
BUFFER_SIZE:=max_values*n;
TargetTime:=SampleRate*max_values*No_Channels;
actual := adc11_set_interval (TargetTime, BUFFER_SIZE, channels, n);
adc11_run (BUFFER_SIZE, BM_STREAM);
etc...
I just wasn't patient enough to wait and see what happend.
But it takes quite a while before I start getting samples, if I set a samplingrate of 1 second I have to wait around 15 seconds before I start to get readings! is that normal behaviour?
At the same time the samplerate is not precisely 1 second but 0.999424 if I sample one channel and 0.901120 if I sample all 11 channels?
I find that the samplerate changes is a little pussling, because if I set the samplerate to say 1ms I get exactly 1ms, so why does it change just because I choose a longer sampleperiod?