Test and Measurement Forum

Duty cycle when sampling in streaming mode

Post any questions you may have about our current range of USB data loggers

Duty cycle when sampling in streaming mode

Postby LPH » Tue Jun 08, 2010 8:04 am


I'm using a pl1216 and I'm unsure aboute the period/duty cycle when sampling in streaming mode. If I set the sampling interval to e.g. 100 msec, what time elapse between the intervals when the device collects data? My collected data is power and I collect these to get a dose (energy) so I need control over time. Are there any other programming related (or other) aspects affecting elapsed time between samples?

Posts: 0
Joined: Wed May 19, 2010 2:08 pm
Location: Stockholm

Re: Duty cycle when sampling in streaming mode

Postby Pico Stuart » Thu Jun 10, 2010 3:45 pm

Dear Patrik,

The devices operate in any of the following modes:

Using PicoLog

Real time continuous mode. The unit collects data as fast as possible, computes a smoothed signal, and then transmits data at a slower rate to the PC. This mode results in the fastest screen updates but is limited in speed to several milliseconds between samples.

Streaming mode. The unit collects and downloads data continuously with a guaranteed sampling interval. For faster sampling, use block mode.

Block mode. The unit collects data to an internal buffer at high speed, and then uploads the buffer contents to the PC as a block. This mode allows the fastest sampling rates, but the data collected has gaps caused by the dead time between blocks.

Using API

Capture modes
Three modes are available for capturing data:
BM_SINGLE: collect a single block of data and exit
BM_WINDOW: collect a series of overlapping blocks of data
BM_STREAM: collect a continuous stream of data
BM_SINGLE is useful when you wish to collect data at high speed for a short period:for example, to collect 1000 readings in 50 milliseconds.

BM_WINDOW is useful when collecting several blocks of data at low speeds - for example when collecting 10,000 samples over 10 seconds. Collecting a sequence of single blocks like this would take 10 seconds for each block, so displayed data would
not be updated frequently. Using windowing, it is possible to ask for a new block more frequently, for example every second, and to receive a block containing 9 seconds of repeat data and 1 second of new data. The block is effectively a 10-second window that advances one second per cycle.

BM_STREAM is useful when you need to collect data continuously for long periods. In principle, it could be used to collect data indefinitely. Every time pl1000GetValues
is called, it returns the new readings since the last time it was called. The noOfValues argument passed to pl1000Run must be sufficient to ensure that the buffer does not overflow between successive calls to pl1000GetValues . For example, if you call pl1000GetValues every second and you are collecting 500
samples per second, then noOfValues must be at least 500, or preferably 1000, to allow for delays in the operating system.


The fastest possible sampling interval is 1 microsecond, when the number of samples
is 8129 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.

Please do not hesitate to contact me if you require further assistance via support@picotech.com

Kindest regards,

Technical Speciliast
Pico Stuart
Site Admin
Site Admin
Posts: 75
Joined: Tue Jun 30, 2009 3:08 pm

Re: Duty cycle when sampling in streaming mode

Postby LPH » Tue Jun 22, 2010 7:18 pm

Hi Stuart,

thanks for Your reply. Im not completely clear about what is happening. I use PicoLog in streaming mode (BM_STREAM) and I call pl1000GetValues inside a while loop. The (pseudo) code looks as follows;


While total < condition

Do while not ready

total = total + collected value
end while

If the interval is say 100ms, what time elapses between successive 100ms intervals? Does it depend on the while loop? I could clock the while loop of course but it seems bulky...

Should the calling of pl1000Run be inside the while loop in streaming mode? Is there a better way to code this?

Is it possible to understand my question? :)

Posts: 0
Joined: Wed May 19, 2010 2:08 pm
Location: Stockholm

Re: Duty cycle when sampling in streaming mode

Postby Robin » Thu Jul 15, 2010 12:38 pm

Hi Patrick

You only need to call Run once and then you can call GetValues in your loop.

As you are using streaming mode, there will be no gaps in the data.

See collect_streaming() in pl1000con.c

Advanced User
Advanced User
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Return to USB PC Data Loggers

Who is online

Users browsing this forum: No registered users and 1 guest