Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int16_t handle;
- PICO_STATUS status;
- auto bufferLength = 1024 * 1024;
- auto bufferMin = (short*)malloc(bufferLength * sizeof(short));
- auto bufferMax = (short*)malloc(bufferLength * sizeof(short));
- ps5000OpenUnit(&handle);
- ps5000SetChannel(handle, PS5000_CHANNEL_A, 1, 1, PS5000_1V);
- ps5000SetSimpleTrigger(handle, 1, PS5000_CHANNEL_A, PS5000_MAX_VALUE / 2, RISING_OR_FALLING, 0, 10000);
- ps5000SetDataBuffers(handle, PS5000_CHANNEL_A, bufferMax, bufferMin, bufferLength);
- uint32_t samplerate = 16;
- status = ps5000RunStreaming(handle, &samplerate, PS5000_NS, 300000, 300000, 1, 1000, bufferLength);
- QFile f("dump.txt");
- f.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text);
- QTextStream stream(&f);
- while(!autoStop) {
- ready = false;
- status = ps5000GetStreamingLatestValues(handle, (ps5000StreamingReady)CallBackStreaming, NULL);
- Sleep(100);
- if(ready){
- for(int i = startIndex; i < sampleCount; i++)
- stream << bufferMax[i] / (double)PS5000_MAX_VALUE << "\n";
- if(sampleCount < 1) break;
- }
- }
- f.close();
- ps5000CloseUnit(handle);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement