Problem setting sample rate for streaming from C#

Post your .Net discussions here
Post Reply
iain.ross
Newbie
Posts: 0
Joined: Fri Oct 28, 2022 2:23 pm

Problem setting sample rate for streaming from C#

Post by iain.ross »

Hi,

I'm having trouble setting the sampling rate from a C# app using a PicoScope 4824. The code previously *seemed* to be working, then I moved it (out of an Akka.Net actor into a standard class) and now it's giving me way more data than I want. I think I'm setting it to stream at 10kHz but after 5s of streaming I've got between 270k and 350k samples rather than ~50k.

I was able to reproduce the issue in a simple console app (.net 6.0.402, 7zip attached). If anyone can spot what I'm doing wrong it would be much appreciated.

Running on Windows 10, v19044.2130

Querying the unit info via the API gives me:
version number of ps4000a DLL: 2.1.82.3072
type of USB connection to device: 1.1, 2.0 or 3.0: 3.0
hardware version of device: 1
variant number of device: 4824A
batch and serial number of device: FT792/123
calibration date of device: 29Mar18
version of kernel driver: 1.0
version of digital board: 1
version of analog board: 1
FW Version 1: 1.7.5.0
FW Version 2: 1.0.11.0

Thanks.
Attachments
ConsoleApp1.7z
(13.44 KiB) Downloaded 58 times

iain.ross
Newbie
Posts: 0
Joined: Fri Oct 28, 2022 2:23 pm

Re: Problem setting sample rate for streaming from C#

Post by iain.ross »

I figured it out.

For anyone who wants to know the answer, in `PicoScopeManager` my callback function passed to the API to collect the streamed data sets a boolean variable `onLatestValuesCalled` to indicate if there are new values to process after a call to `ps4000aGetStreamingLatestValues`. When this is `true` and I process the buffered data in my app I was failing to reset it to `false` and so processing the same data repeatedly.

Post Reply