ADV11/12 How do you set samplerate when streaming

Post general discussions on using our drivers to write your own software here
Post Reply
pako

ADV11/12 How do you set samplerate when streaming

Post by pako »

Hi

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?

Regards Palle Koch

User avatar
markspencer
Site Admin
Site Admin
Posts: 598
Joined: Wed May 07, 2003 9:45 am

Post by markspencer »

Hi,

So that we can investiaate further can you provide the additional information:

What is n set to (number of channels)?

What is the BUFFER_SIZE set to?

What is the value of actual after the function has been executed?

Once I have these details I will baable to make an informed answer.

Best regards,
Regards,

Mark Spencer

pako

Post by pako »

Sorry! here is the code I use:

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:

no_of_values := adc11_get_times_and_values (mytimes, myvalues, BUFFER_SIZE);

always returns timevalues with increments of 66us for one channel, 133us for two channels, 200us for three etc...

The 'actual' variable returns the number of samples that I would expect instead of the actual time.

So I suspect that the values I get is just readout very slowly, but actually sampled very fast!

Please explain in detail what I should expect, and how to interpret the parameters when streaming.

Regards Palle Koch

pako

Post by pako »

Oups!

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?

Regards Palle Koch

pako

Post by pako »

Hi again

If I continue to stream data as described above, I get a Errormessage from MEMMGR saying: End guard damaged File adc11usb.c line 1410

Is there some kind of handling that I have forgotten, it seams like I am running out of memoryspace, stackspace or something like that?

Regards Palle Koch

Post Reply