I would like to see how to code in C++ to capture multi channels streaming
- the distributed example code shows only one channel and I cant make it work for 16 channels (400 samples in 400000uS, 6400 samples)
this is the one channel code (works)
/****************************************************************************
*
* Collect_streaming
*
* This function demonstrates how to use streaming.
*
****************************************************************************/
void collect_streaming (void)
{
unsigned int i;
short channels [] = {1};
unsigned long nSamples = 1000;
short nChannels = 1;
unsigned long nSamplesPerChannel = 1000;
unsigned long nSamplesCollected;
unsigned short samples[1000];
unsigned long usForBlock = 1000000;
unsigned short *overflow = 0;
unsigned long triggerIndex = 0;
short nLines = 0;
FILE *fp;
printf ("Collect streaming...\n");
printf ("Data is written to disk file (test.out)\n");
printf ("Press a key to start\n");
_getch();
//Set the trigger (disabled)
status = pl1000SetTrigger(g_handle, FALSE, 0, 0, 0, 0, 0, 0, 0);
//set sampling rate and channels
status = pl1000SetInterval(g_handle, &usForBlock, nSamples, channels, nChannels);
//Start streaming
status = pl1000Run(g_handle, nSamples, BM_STREAM);
//Wait until unit is ready
isReady = 0;
while(isReady == 0)
{
status = pl1000Ready(g_handle, &isReady);
}
printf("Press any key to stop\n");
fopen_s(&fp, "test.out", "w");
unsigned long nSamples = 6400;
unsigned long nSamplesPerChannel = 400;
unsigned long usForBlock = 400000;
unsigned short samples[6400]; // This is a temporary buffer used to retrieve data from the driver
Please also refer to section 3.3.13 (pl1000SetInterval) in the PicoLog 1000 Series Programmer's Guide:
You will then need to loop calling the pl1000GetValues requesting data and stop when you have collected the required number of samples. When you call the pl1000GetValues function, it will indicate the number of values per channel that were collected since the last collection of data.