Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 9208 possibly sampling too fast?

I'm working on rewriting a legacy VB6 application which uses a 9208 card to read 14 4-20mA values. I'm using VB.NET.

 

The code in the old sample app indicates it's reading at 700 samples per 0.1 seconds, so 7000Hz. Here's the initial setup -

 

moduleTask.Timing.ConfigureSampleClock("", 7000, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples)

 

And here's the reading data part (this is all mostly using samples to build together). The code averages these 700 samples and displays it.

 

' Retrieve data
readData = analogReader.EndReadWaveform(ar)

' Average data over each channel and fire event
Dim averageDataPerChannel = readData.Select(Function(channelData)
                                                Return channelData.Samples.Average(Function(s)
                                                                                       Return s.Value
                                                                                   End Function)
                                            End Function).ToList()

 

This all works without any errors, and I'm receiving a callback every ~0.1s, so that appears to work.

 

The data received looks a bit weird though. It seems like it only changes sometimes, often returning an identical data set. Here's an example of what I'm seeing over 1 second

 

2023-06-20T23:10:05.162, Inlet = 4.95582848525941, Outlet = 11.904091352453028,,11
2023-06-20T23:10:05.271, Inlet = 4.95582848525941, Outlet = 11.904091352453028,,11
2023-06-20T23:10:05.366, Inlet = 4.95582848525941, Outlet = 11.904091352453028,,11
2023-06-20T23:10:05.460, Inlet = 4.95582848525941, Outlet = 11.904091352453028,,11
2023-06-20T23:10:05.572, Inlet = 4.95582848525941, Outlet = 11.904091352453028,,11
2023-06-20T23:10:05.666, Inlet = 4.95582848525941, Outlet = 11.904091352453028,,11
2023-06-20T23:10:05.761, Inlet = 5.3756550178488345, Outlet = 11.509599179626639,,6
2023-06-20T23:10:05.870, Inlet = 5.526244969758509, Outlet = 11.368096552406088,,6
2023-06-20T23:10:05.964, Inlet = 5.526244969758509, Outlet = 11.368096552406088,,6
2023-06-20T23:10:06.058, Inlet = 5.526244969758509, Outlet = 11.368096552406088,,6
2023-06-20T23:10:06.168, Inlet = 5.526244969758509, Outlet = 11.368096552406088,,6

 

I'm wondering if I'm over-sampling and the device can't really keep up so is returning old data.

 

I think I saw on the spec that this can return 50S/s, which I assume is Samples/second. If that's the case, then I definitely can't do what I'm reading in the old code. Is 50S/s per input?

 

Thanks!

0 Kudos
Message 1 of 1
(1,043 Views)