thank you for your help. I have implemented your workflow and it is working fine if I collect the raw data for all channels aswell. But it behaves strange if I try to collect raw data only for certain channels.
I set up buffers for raw data like this:
- Code: Select all
for (i = 0; i < unit->channelCount; i++)
if ((i >= DUAL_SCOPE && unit->channelCount == QUAD_SCOPE && powerStatus == PICO_POWER_SUPPLY_NOT_CONNECTED) || !rawData[i])
// No need to set the channels C and D if Quad channel scope and power supply not connected.
// No need to set the channels if no raw data is needed.
unit->channelSettings[i].enabled = FALSE;
buffers2[i * 2] = (int16_t*)calloc(preTrigger + postTrigger, sizeof(int16_t));
buffers2[i * 2 + 1] = (int16_t*)calloc(preTrigger + postTrigger, sizeof(int16_t));
status = ps5000aSetDataBuffers(unit->handle, (PS5000A_CHANNEL)i, buffers2[i * 2], buffers2[i * 2 + 1], preTrigger + postTrigger, 0, PS5000A_RATIO_MODE_NONE);
appBuffers2[i * 2] = (int16_t*)calloc(preTrigger + postTrigger, sizeof(int16_t));
appBuffers2[i * 2 + 1] = (int16_t*)calloc(preTrigger + postTrigger, sizeof(int16_t));
printf(status ? "StreamDataHandler:ps5000aSetDataBuffers(channel %ld) ------ 0x%08lx \n" : "", i, status);
I use rawData to tell the application which channels I need raw data. I then call ps5000GetValuesAsync() like this:
- Code: Select all
status = ps5000aGetValuesAsync(unit->handle, 0, preTrigger + postTrigger, 1, PS5000A_RATIO_MODE_NONE, 0, callBackStreaming, &bufferInfo2);
I would now assume that I would get preTrigger+postTrigger amount of data points, currently 1000000, for the channel I want raw data from. But for some reason I only get 50000 data points which is the sampleCount value previously set for streaming.
I use the same callBackStreaming() for both GetStreamingLatestValues() and GetValuesAsync(), but this doesn't make any problem when I set buffers for all channels. I thought through disabling certain channels I could achiev to only get raw data for certain channels.
Is there something I have overlooked?
Edit: I have an additional question regarding memory. If I understand the functionality correctly, the osciloscope is saving the raw data in an internal buffer. In case of the 4824 this would be 256 MS and in case of the 5443A this would be 64 MS. As all channels are saved constantly, the maximum number of samples you can save per channel is 32 MS for the 4824 and 16 MS for the 5443A. This would limit the maximum duration of measurment or the maximum sample rate, as if the internal buffers are full, raw data gets lost as it is overwritten. My question is if I have understood this correctly and if there are ways to counteract this problem?