Error: The sample time interval is out of range

Post your C and C++ discussions here
Post Reply
Philemon
Newbie
Posts: 0
Joined: Mon Mar 28, 2016 9:44 am

Error: The sample time interval is out of range

Post by Philemon »

Hello all,

I keep getting this error (The sample time interval is out of range) while running ADC-24. i cant understand what does it mean. i didnt find anything in the manual for the range of the interval other than it has to be longer than (conversionTime)*(NoOfChannels).

Also, there are times that function HRDLRun(....) takes forever to return something. and the programm just stayes there waiting. and other times it just executes in no time. Could this be a problem or should i just wait till it finishes.

can someone help?
thanks a lot!!
Philemon

Hitesh

Re: Error: The sample time interval is out of range

Post by Hitesh »

Hi Philemon,

Could you please post your code to show what parameters you are setting for the channels as well as the HRDLSetInterval() function?

With regards to the HRDLRun() function, what mode of collection are you using and what is the version of the picohrdl dll?

Regards,

Philemon
Newbie
Posts: 0
Joined: Mon Mar 28, 2016 9:44 am

Re: Error: The sample time interval is out of range

Post by Philemon »

Hi Hitesh,
thanks for the reply.

here is the code for the two functions i use for setting the channels and interval

Code: Select all

int SetChannels()
{
	int i, choise=0, yn, more, choiseChannel, choiseRange, existance=0, errorCode;
	char line[80];

	for(i=0; i<16; i++)
	{
		s_channelSettings[i].enabled = 0;
		s_channelSettings[i].error = 1;
		s_channelSettings[i].range = 0;
	}
/*---------------------Selecting-Channels-------------------------------------------*/
	printf("\nHow many channels do you want to use? (1-16) \n... ");
	scanf("%d", &NumberOfChannels);

	if(NumberOfChannels == 16)
	{
		for(i=0; i<16; i++)
			s_channelSettings[i].enabled = 1;

		printf("\nAll channels are active");
	}

	if(NumberOfChannels!=16)
	{
		printf("\nInput the numbers, of the channels you want to use (1-16)\n");

		for(i=0; i
As for the HRDLRun() function, i use the block for the mode of collection (HRDL_BM_BLOCK)
and for the picohrdl.dll version, is 1.4.0.205

thank you

Hitesh

Re: Error: The sample time interval is out of range

Post by Hitesh »

Hi Philemon,

What are you setting for the value of Rate?

Having run your code with, I can see that Rate is being assigned to an int value which could be causing a problem (particularly when the rate is less than 1 as it results in a divide by zero exception).

I would suggest the following:

Code: Select all

float Rate;
scanf("%f", &Rate);
If this does not work, then what values are you passing into the HRDLSetInterval() function?

With regards to the HRDLRun() function, please e-mail support@picotech.com indicating if you require a 32-bit or 64-bit driver and this can be made available for you to download.

Regards,

Philemon
Newbie
Posts: 0
Joined: Mon Mar 28, 2016 9:44 am

Re: Error: The sample time interval is out of range

Post by Philemon »

Hello Hitesh,

For the value of Rate: i am using this value to overcome the difficult (for me) concept of interval. i was thinking that, instead of asking the user to insert the conversion time and the interval, to ask him to input the conversion time and the rate (samples per second (Hz)). i do that because i find the concept of rate easier to use and more familiar for the user, since it is more common to speak about the sample rate than the sample interval. of course thats the way i see it and it doesnt have to be correct. Actually, could you please tell my why pico used interval rather than rate?

You are right about the int, i used it cause my usage will be with integer type rate, but you are right, i will change it.

The values i'm passing to HRDLSetInterval() are:
-TheDevice : global int type, the return of HRDLOpen(), what is called "handle" in the manual.
- interval : the interval for the collecting of the values. interval = 1000/Rate (splits 1 second in how many times the user wants to take a sample) (i believe the problem lies here, but im not sure what is it)
- HRLD_NUMBERMS : the conversion time chosen by the user.

thanks for the advice, i will send the mail!

thank you for the reply!
Phil

Hitesh

Re: Error: The sample time interval is out of range

Post by Hitesh »

Hi Phil,

We refer to interval as opposed to rate as each reading takes time to settle to it's final value due to the fact that these are high resolution devices.

It might be useful to know the actual value being passed for the interval parameter and the conversion time selected in the call to HRDLSetInterval() when the error occurs as well as how many channels are enabled as this may give some indication as to why an error code is returned.

Did you send an e-mail to us?

Regards,

Philemon
Newbie
Posts: 0
Joined: Mon Mar 28, 2016 9:44 am

Re: Error: The sample time interval is out of range

Post by Philemon »

Hello Hitesh,

I see. So, this time that each reading needs, is excactly equal to the conversion time. right? or a little bit more?

The actuall values are (in the format of: (interval,conversion_time,channels):
*All uses of HRDLRun() in block mode

- (334, HRDL_60MS, 5), (200, HRDL_100MS, 2) error-> stucks between HRDLRun() and HRDLReady
- (334, HRDL_60MS, 5) error -> error number 2 after HRDLSetIntervals()
- (1000, HRDL_60MS, 16) error -> none, works fine
- (___, HRDL_60MS, 1) intreval: 63, 100, 112, 125, 143, 167, 200, 250, 334 error -> error number 2 after HRDLSetIntervals()
- (500, HRDL_60MS, 1) error-> during HRDL(GetTimesAndValues() crashes

- (1000, HRDL_60MS, 16) stream mode, error-> HRDLGetTimesAndValues() returns 0 either without returning any values or after returning just from the first run of the loop.


i did send you the mail yesteray.

thanks a lot!!
phil

Philemon
Newbie
Posts: 0
Joined: Mon Mar 28, 2016 9:44 am

Re: Error: The sample time interval is out of range

Post by Philemon »

Also, forgot to tell,
i work with Eclipse Mars 2, on windows 7.

Hitesh

Re: Error: The sample time interval is out of range

Post by Hitesh »

Hi Phil,

Thanks for the information.

I've run some tests but am unable to reproduce the issue. Could you please post code that I can run here in order to try and replicate the issue?

I've seen that you've e-mailed us. Has the new driver had any impact?

Regards,

Philemon
Newbie
Posts: 0
Joined: Mon Mar 28, 2016 9:44 am

Re: Error: The sample time interval is out of range

Post by Philemon »

Hello!

I did email you but I couldn't download the file cause it wouldn't allow me, I needed some authorization. Could you please send it again?

Thanks again!
Phil

Hitesh

Re: Error: The sample time interval is out of range

Post by Hitesh »

Hi Phil,

The link has been checked. Could you please try it again and if you encounter the problem again please respond via your e-mail support ticket.

Thanks,

Post Reply