Electronic Engineer Discuss

Title: C# project for Hantek6074BC [Print this page]

Author: Jambyl    Time: 2018-8-20 19:05
Title: C# project for Hantek6074BC
Good day!

I bought the Hantek 6074BC and I'm developing a program that needs to take data from the device and determine the peaks.
Peak points should be sent to the server with time. The program is developed on c #.
I already connected the .dll library to the program and the initialization was successful and I can not get the data

A
1 dsoHTCHPos
2 dsoHTVTriggerLevel
3 dsoHTSetTriggerMode

B
1 dsoHTStartCollectData
2 dsoHTGetState
3 dsoHTGetData

You can describe these methods in more detail. I needs every 30 milliseconds to take the data as an array from the device
I can send full project
Help please! Thank you in advance!


Author: oscor    Time: 2019-2-9 09:19
Hello Jambyl,

I'm stuck in a similar situation (but with the 6254BC model). Did you finally manage to make it work?

Thanks,

Oscar

Author: ArnaudB    Time: 2021-8-26 21:30
I have the same problem.
Most of the HTHardDll.dll functions works well, but I have troubles with dsoHTGetData: it always returns 0.
Any ideas ?

Author: e_admin    Time: 2021-8-27 09:06
Please refer  VC demo,it is hard to find the reason;
possible resons:
1  before collect ,call  check "status=dsoHTGetState"  if the device finished collect,status&2=2
2  many init function is not called  please refer to  vcdemo  



Author: ArnaudB    Time: 2021-8-30 21:41
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 :

  1.             ushort[] readBufferCH1 = new ushort[8192];
  2.             ushort[] readBufferCH2 = new ushort[8192];
  3.             ushort[] readBufferCH3 = new ushort[8192];
  4.             ushort[] readBufferCH4 = new ushort[8192];

  5.             int result = GetData(Hantek_DeviceIndex, readBufferCH1, readBufferCH2, readBufferCH3, readBufferCH4, stControl);

  6.             for (int i = 0; i < 8192; i++)
  7.             {
  8.                 CHRead_Buffer[i, 0] = readBufferCH1[i];
  9.                 CHRead_Buffer[i, 1] = readBufferCH2[i];
  10.                 CHRead_Buffer[i, 2] = readBufferCH3[i];
  11.                 CHRead_Buffer[i, 3] = readBufferCH4[i];
  12.             }
Copy the Code


And here is the call to the dll :

  1.         [DllImport("HTHardDll.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
  2.         private static unsafe extern int dsoHTGetData(int nDeviceIndex, ushort* CH1Data, ushort* CH2Data, ushort* CH3Data, ushort* CH4Data, ref ControlData pSTControl);

  3.         public int GetData(int nDeviceIndex, ushort[] CH1Data, ushort[] CH2Data, ushort[] CH3Data, ushort[] CH4Data, ControlData pSTControl)
  4.         {
  5.             unsafe
  6.             {
  7.                 fixed (ushort* pCH1Data = CH1Data)
  8.                 fixed (ushort* pCH2Data = CH2Data)
  9.                 fixed (ushort* pCH3Data = CH3Data)
  10.                 fixed (ushort* pCH4Data = CH4Data)
  11.                 {
  12.                     return dsoHTGetData(nDeviceIndex, pCH1Data, pCH2Data, pCH3Data, pCH4Data, ref pSTControl);
  13.                 }
  14.             }
  15.         }
Copy the Code


And last thing that may cause the problem : the ControlData. Here is how mine looks like :

  1.                 nCHSet = 15,
  2.                 nTimeDiv = 16,
  3.                 nTriggerSource = 0,
  4.                 nHTriggerPos = 50,
  5.                 nVTriggerPos = 192,
  6.                 nTriggerSlope = 0,
  7.                 nBufferLen = 8192,
  8.                 nReadDataLen = 8192,
  9.                 nAlreadyReadLen = 0,
  10.                 nALT = 0
Copy the Code


Thanks a lot in advance for the help





Welcome to Electronic Engineer Discuss (https://www.eediscuss.com/) Powered by Discuz! X3.2