PICOLOG 1216 - getvalue function

Post your C and C++ discussions here
Post Reply
Fabrix

PICOLOG 1216 - getvalue function

Post by Fabrix » Tue Feb 22, 2011 7:34 am

Hi,
I am controlling the Picolog 1216 for data acquisition by using some C routines. I am modifying the C code examples to get 1 minute of acquisition at 10 Ksps per two channels in streaming mode, but it is not clear to me how I can get the samples from two channels using the pl1000GetValues function. Any suggestions/references?
Moreover, I would also like to retrieve the time-stamp from each acquired sample, is there any function in the lib file that could retrieve it?

Thanks in advance.

Regards.

Chris
Site Admin
Site Admin
Posts: 169
Joined: Tue Aug 17, 2010 9:00 am
Location: St. Neots

Re: PICOLOG 1216 - getvalue function

Post by Chris » Wed Feb 23, 2011 11:34 am

To use 2 channels, you need declare...

short channels [] = {1, 2};
short nChannels = 2;

and call...

status = pl1000SetInterval(g_handle, &usForBlock, nSamples, channels, nChannels);

status = pl1000GetValues(g_handle, &samples[0], &nSamplesCollected, overflow, &triggerIndex);

The samples array will have the collected samples from channel 1 & channel 2 interleaved....1st value = channel 1, 2nd value = channel 2, 3rd value = channel 1, 4th value = channel 2, etc.

There isn't a function to record timestamps. This will have to be calculated from the sample interval, and the number of samples collected.

Fabrix

Re: PICOLOG 1216 - getvalue function

Post by Fabrix » Mon Feb 28, 2011 7:18 am

Thanks a lot for the info.

I am now experiencing another problem.

I set the sampling rate to 10 Ksamp/s by setting the variables "usForBlock" and "nSamples" respectively to 60000000 and 600000, for two channels acquisition as previously mentioned.
Therefore, I call the getValue function every 400 milliseconds considering a number of samples per channel ( variable "nSamplesPerChannel") equal to 8000 (maximum capability of the buffer).
Unfortunately instead of retrieving 8 Ksamples at each call as I would expect ( 10Ksamp/s * 2 channels * 0.4 s = 8 Ksamples), I get only 4 Ksamples at each call, making my acquisition two times longer than I want. It seems to me that the rate of writing the samples in the buffer is the same as the sampling rate of each channel, instead of the sampling rate of each channel multiplied by the number of channels.

Did I get it wrong? Am I doing something stupid?

Cheers,

Fabrix

Chris
Site Admin
Site Admin
Posts: 169
Joined: Tue Aug 17, 2010 9:00 am
Location: St. Neots

Re: PICOLOG 1216 - getvalue function

Post by Chris » Thu Mar 10, 2011 4:16 pm

The number of samples you want to collect is the total number, so to get 10Ks/s on 2 channels you'd need to have a 20Ks/s sample rate.

You could therefore reduce the usForBlock from 60000000 to 30000000 or increase the nSamples parameter from 600000 to 1200000

Post Reply