I am looking for some guidance setting up the data buffers using C#. We have a PS5244A and we have been using it in blockmode on a single channel based on your BlockModeExample.
I tried to implement the dual channel following the instructions of the API manual:
--Enabled and set both channels
--Call SetSimpleTrigger to setup channel A as my driving channel (I am assuming channel B will still be collected?)
--Set data buffers as follow:
- Code: Select all
short minBuffersChA = new short[sampleCount];
short maxBuffersChA = new short[sampleCount];
minPinned[ictr] = new PinnedArray<short>(minBuffersChA);
maxPinned[ictr] = new PinnedArray<short>(maxBuffersChA);
status = Imports.SetDataBuffers(_handle, Imports.Channel.ChannelA , maxBuffersChA, minBuffersChA, (int)sampleCount, 0, Imports.RatioMode.None);
I do the same for channel B
--Call status = Imports.GetTimebase(_handle, _timebase, (int)sampleCount, out timeInterval, out maxSamples, 0);
--Call Imports.RunBlock(_handle, 0, (int)sampleCount, _timebase, out timeIndisposed, 0, _callbackDelegate, IntPtr.Zero);
--Imports.GetValues(_handle, 0, ref sampleCount, 1, Imports.DownSamplingMode.None, 0, out overflow);
At this point I assume maxBuffersChA and maxBuffersChB has the data that I want to analyze. However I am getting zeros. I am not sure if I setup the buffer arrays properly or if I am calling proper functions. I have to say I feel a bit uneasy as I am not sure if the functions I listed before are taking into account what channels are active or not. I believe they are but then it makes me think, when I setup the buffer arrays, the size of those buffers is related to single channels? Also I am not sure what the PinnedArray template is doing here. I am not clear if I could access those objects instead of the short buffer objects when processing the data at the end of the block call. As you see, C# is not my forte.
Just to finished the details of my file setup, I would like to mention that when we were running in one channel mode, we were collecting 10^5 samples at 16 BitResolution with time base of 5 (aka. 32ns). When I setup two channels, I change my resolution to 15BitRes and I set my time base to 6 (to preserve 32ns).
Could I get you advice please? If desired, I could post my code but I have to clean it up a bit.