PicoLog1216, PICO_INVALID_SAMPLE_INTERVAL

Forum for discussing PicoLog
Post Reply
tonbo
Newbie
Posts: 0
Joined: Thu Mar 16, 2017 12:11 am

PicoLog1216, PICO_INVALID_SAMPLE_INTERVAL

Post by tonbo »

Hellow, Martyn Technical Specialist

I am a new PicoLog1216 user.
I am trying to obtain stream data with a short block time.

Hardware Version : 1
Serial Number : CU981/227
Calibration Date : 17Feb16
Kernel Version : PICOPP.SYS V1.0
pl1000.dll Version : 1.0.9.2

Original Sample Program pl1000con.c : 08June15

1.*** OK ***
int16_t g_handle;
int16_t channels [] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
int16_t nChannels = 16;
uint32_t usForBlock = 20000; //Block time, 20000μs
uint32_t nSamples = 2000; //Block size, 2000
uint32_t nSamplesPerChannel = 2000 / 16; //125 / ch, Reference

status = pl1000OpenUnit(&g_handle);
status = pl1000SetTrigger(g_handle, FALSE, 0, 0, 0, 0, 0, 0, 0);
status = pl1000SetInterval(g_handle, &usForBlock, nSamples, channels, nChannels);
status = pl1000Run(g_handle, nSamples, BM_STREAM);

then
status : 0: PICO_OK
( sampling rate = usForBlock / nSamples = 20000 / 2000 = 10μs )

2.*** NG ***
int16_t g_handle;
int16_t channels [] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
int16_t nChannels = 16;
uint32_t usForBlock = 20160; //Block time, 20160μs
uint32_t nSamples = 224; //Block size, 224
uint32_t nSamplesPerChannel = 224 / 16; //14 / ch, Reference

status = pl1000OpenUnit(&g_handle);
status = pl1000SetTrigger(g_handle, FALSE, 0, 0, 0, 0, 0, 0, 0);
status = pl1000SetInterval(g_handle, &usForBlock, nSamples, channels, nChannels);
status = pl1000Run(g_handle, nSamples, BM_STREAM);

then
status : 2B: PICO_INVALID_SAMPLE_INTERVAL.
The sample interval selected for streaming is out of range.
( sampling rate = usForBlock / nSamples = 20160 / 224 = 90μs > 10μs )

Q1.Why is it "INVALID" ?

Q2.What is the correct combination rule between "usForBlock" and "nSamples" ?

Thanks

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: PicoLog1216, PICO_INVALID_SAMPLE_INTERVAL

Post by Martyn »

From the Programmer's Guide

Code: Select all

The fastest possible sampling interval is 1 microsecond, when the number of samples is 8192 divided by the number of channels active and the capture mode is BM_SINGLE.

Under all other conditions, the fastest possible sampling interval is 10 microseconds per channel.
The fastest possible data collection in the streaming settings is 100 kS/s (10 μs per sample), shared across all channels.
So block time needs to be 35840

Code: Select all

	int16_t channels[] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 };
	int16_t nChannels = 16;
	uint32_t usForBlock = 35840; //Block time, 20160μs
	uint32_t nSamples = 224; //Block size, 224
	uint32_t nSamplesPerChannel = 224 / 16; //14 / ch, Reference
Martyn
Technical Support Manager

tonbo
Newbie
Posts: 0
Joined: Thu Mar 16, 2017 12:11 am

Re: PicoLog1216, PICO_INVALID_SAMPLE_INTERVAL

Post by tonbo »

Hellow, Martyn

Thank you for your answer.
I tried it like you pointed out.

int16_t channels[] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 };
int16_t nChannels = 16;
uint32_t usForBlock = 35840; //Block time, 35840μs
uint32_t nSamples = 224; //Block size, 224
uint32_t nSamplesPerChannel = 224/16; //

Then
All status became PICO_OK. :D
However AD is now starting from ch 13. :roll:

Q3.What does this expression mean? Is it correct?
nSamplesPerChannel = 224/16

Q4.Is this formula correct?
sampling rate = usForBlock / nSamples / 16 = 35840 / 224 / 16 = 10μs

Thanks

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: PicoLog1216, PICO_INVALID_SAMPLE_INTERVAL

Post by Martyn »

We have received your email and will reply to that :)
Martyn
Technical Support Manager

tonbo
Newbie
Posts: 0
Joined: Thu Mar 16, 2017 12:11 am

Re: PicoLog1216, PICO_INVALID_SAMPLE_INTERVAL

Post by tonbo »

Hello, Martyn

Thank you.

I want to operate correctly under the following conditions:

int16_t channels[] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 };
int16_t nChannels = 16;
uint32_t usForBlock = 35840;

and
sampling rate : 10μs

tonbo

Post Reply