|
Thanks for your answer e_admin. Now dsoHTGetData returns 1, but I still have troubles to get all the data. According to vcdemo I created 4 arrays of ushort, and sent the pointers to dsoHTGetData. I get back 190 values for CH1 and CH2, and nothing for CH3 and CH4. I expect 8192 values for the 4 arrays so there is a lot missing. I dont know whats going wrong. Here is how I call the function :
- ushort[] readBufferCH1 = new ushort[8192];
- ushort[] readBufferCH2 = new ushort[8192];
- ushort[] readBufferCH3 = new ushort[8192];
- ushort[] readBufferCH4 = new ushort[8192];
- int result = GetData(Hantek_DeviceIndex, readBufferCH1, readBufferCH2, readBufferCH3, readBufferCH4, stControl);
- for (int i = 0; i < 8192; i++)
- {
- CHRead_Buffer[i, 0] = readBufferCH1[i];
- CHRead_Buffer[i, 1] = readBufferCH2[i];
- CHRead_Buffer[i, 2] = readBufferCH3[i];
- CHRead_Buffer[i, 3] = readBufferCH4[i];
- }
Copy the Code
And here is the call to the dll :
- [DllImport("HTHardDll.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
- private static unsafe extern int dsoHTGetData(int nDeviceIndex, ushort* CH1Data, ushort* CH2Data, ushort* CH3Data, ushort* CH4Data, ref ControlData pSTControl);
- public int GetData(int nDeviceIndex, ushort[] CH1Data, ushort[] CH2Data, ushort[] CH3Data, ushort[] CH4Data, ControlData pSTControl)
- {
- unsafe
- {
- fixed (ushort* pCH1Data = CH1Data)
- fixed (ushort* pCH2Data = CH2Data)
- fixed (ushort* pCH3Data = CH3Data)
- fixed (ushort* pCH4Data = CH4Data)
- {
- return dsoHTGetData(nDeviceIndex, pCH1Data, pCH2Data, pCH3Data, pCH4Data, ref pSTControl);
- }
- }
- }
Copy the Code
And last thing that may cause the problem : the ControlData. Here is how mine looks like :
- nCHSet = 15,
- nTimeDiv = 16,
- nTriggerSource = 0,
- nHTriggerPos = 50,
- nVTriggerPos = 192,
- nTriggerSlope = 0,
- nBufferLen = 8192,
- nReadDataLen = 8192,
- nAlreadyReadLen = 0,
- nALT = 0
Copy the Code
Thanks a lot in advance for the help
|
|