Please select To the mobile version | Continue to access the desktop computer version

Electronic Engineer Discuss

View: 8868|Reply: 4

C# project for Hantek6074BC

[Copy link]

1

Threads

1

Posts

1

Credits

新手上路

Rank: 1

Credits
1
Post time 2018-8-20 19:05:38 | Show all posts |Read mode
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!

This post contains more resources

You have to Login for download or view attachment(s). No Account? Register

x
Reply

Use magic Report

1

Threads

2

Posts

2

Credits

新手上路

Rank: 1

Credits
2
Post time 2019-2-9 09:19:41 | Show all posts
Hello Jambyl,

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

Thanks,

Oscar

3

Threads

6

Posts

6

Credits

新手上路

Rank: 1

Credits
6
Post time 2021-8-26 21:30:23 | Show all posts
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 ?

3

Threads

9

Posts

9

Credits

新手上路

Rank: 1

Credits
9
Post time 2021-8-27 09:06:28 | Show all posts
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  


3

Threads

6

Posts

6

Credits

新手上路

Rank: 1

Credits
6
Post time 2021-8-30 21:41:14 | Show all posts
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
You have to log in before you can reply Login | Register

Points Rules

Dark room|Mobile|Archiver|Electronic Engineer Discuss

2024-3-28 21:39 GMT+8 , Processed in 0.221873 second(s), 22 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

Quick Reply To Top Return to the list