Sample rate , scan time on U3 | LabJack
 

Sample rate , scan time on U3

2 posts / 0 new
Last post
ANNA
ANNA's picture
Sample rate , scan time on U3

Hello world ,

I just started using U3-HV for acquisition of electrical signals (voltage,current) , so i started working with the example code C/C++ , i did install the exodriver and i'm working with the u3stream.c code provided in the exodriver file.

https://labjack.com/support/software/installers/exodriver

i did read the datasheet https://labjack.com/support/datasheets/u3/operation/stream-mode and it's specifed that we can make a streaming acquisition with different sample rate.But the problem is i don't what i have to change in the stream code , to change this sample rate ( i want to use 2 channels) . how can i get the maximum sample rate ?  and how can i change the streaming time ( i want to use 5/10sec).

Thank you ,

File Attachment: 
LabJack Support
labjack support's picture
Take a look at the

Take a look at the StreamConfig low-level command-response documentation for stream configuration documentation:

https://labjack.com/support/datasheets/u3/low-level-function-reference/s...

For 50000 samples per second (50 kHz) streaming, set the resolution to 10.5 bit. The max. sample rate is 50 kHz, where:

sample rate = scan rate * # of channels

When streaming 2 channels (2 channel scan), the maximum scan rate is 25 kHz. Low-level command wise, the scan interval setting controls the scan rate of stream mode. For the 25 kHz scan rate, and if the internal stream clock frequency is 4 MHz, the scan interval is 160. Note that:

interval (in seconds) between scans = ScanInterval / ClockFrequency

So:

ScanInterval = (1 / ScanRate) * ClockFrequency
ScanInterval = (1 / 25000) * 4000000
ScanInterval = 160

In code:

NumChannels = 2;

//...

int StreamConfig_example(HANDLE hDevice)
{
    //...
    sendBuff[9] = 3;  //b00000011
    scanInterval = 160;
    sendBuff[10] = (uint8)(scanInterval & (0x00FF));  //Scan interval (low byte)
    sendBuff[11] = (uint8)(scanInterval / 256);  //Scan interval (high byte)
    //...

Regarding streaming time, based on the scan rate you can determine how many scans of data will provide X amount of time of data. For examples, at a 25000 kHz scan rate, 10 seconds of data would be 250000 scans of data (ScanRate*Time) which is 500000 samples total for 2 channels (ScanRate*#Channels*Time).