Hantek DSO3064A SDK manual HTHardDLL

SDK - HTHardDll.dll Manual
VC++6.0 IDE
Note:
HTHardDll.dll was compiled under VC++6.0. WORD: unsigned short, 16 Bits UCHAR: unsigned char, 8 Bits BOOL: 32 Bits ULONG: unsigned long
The following ifdef block is the standard way of creating macros which make exporting from a DLL simpler. All files within this DLL are compiled with the DLL_API symbol defined on the command line. this symbol should not be defined on any project that uses this DLL. This way any other project whose source files include this file see DLL_API functions as being imported from a DLL, wheras this DLL sees symbols defined with this macro as being exported.
#ifndef DLL_API #define DLL_API extern "C" __declspec(dllimport) #endif
Define __stdcall:
#define WIN_API __stdcall
Defines the struct for the application.
_HT_RELAY_CONTROL contains the relay control information.
typedef struct _HT_RELAY_CONTROL
{ BOOL bCHEnable[4]; WORD nCHVoltDIV[4]; WORD nCHCoupling[4]; BOOL bCHBWLimit[4]; WORD nTrigSource; BOOL bTrigFilt; WORD nALT; }RELAYCONTROL,*PRELAYCONTROL;
Parameters Remarks: bCHEnable[4]: The channel is enable/disable.Value: 1 is enable; 0 is disable. nCHVoltDIV[4]: The VOLT/DIV index of the channel.
nCHCoupling[4]: The coupling index of the channel .
ValueDC is 0AC is 1GND is 2
bCHBWLimit[4]The bandwidth of the channel.
Value: be enable is 1: be disable is 0. nTrigSource:The index of the trigger source. If the channel has 4 channels, the value is : CH1 is 0, CH2 is 1, CH3 is 2 , …… bTrigFilt:The High Frequency Rejection. Be enable is 1, disable is 0. nALTIf the trigger is alternate trigger, the value is 1, otherwise is 0.
Example:
Declare a variable: RELAYCONTROL myRelayControl; Declare a pointer: PRELAYCONTROL pRelayControl;
_HT_CONTROL_DATA contains some controls.
typedef struct _HT_CONTROL_DATA
{ WORD nCHSet;//Channel Enable/Disable
//The 0 bit: 0 is enable, 1 is disable. // The 1 bit: 0 is enable, 1 is disable. // The 2 bit: 0 is enable, 1 is disable. // The 3 bit: 0 is enable, 1 is disable. WORD nTimeDIV; //The index of time Base WORD nTriggerSource; // The index of the trigger source WORD nHTriggerPos; //The Horizontal Trigger Pos (Value: 0 ~ 100) WORD nVTriggerPos; //The Vertical Trigger Pos (Value: 0 ~ 255) WORD nTriggerSlope; //The Edge trigger Slope (Rise slope is 0,Fall slope is 1) ULONG nBufferLen; //The buffer Length ULONG nReadDataLen; //The Data Length of have be read. WORD nALT; // Is alternate trigger or not
WORD nDriverCode; //The Driver Version
}CONTROLDATA,*PCONTROLDATA;
Example:
Declare a variable: CONTROLDATA myControlData; Declare a pointer: PCONTROLDATA pControlData;
Functions:
1. DLL_API WORD WINAPI dsoHTSearchDevice(short* pDevInfo)
Return Value:
The number of have connected devices.
Parameters: pDevInfo pointer to devices information that have connected to PC. Remarks: You should call this function to know how many devices that have connected to PC. One PC supports 32 devices to be connected. Example:
short DevInfo[32];
WORD nConnectedDevNum = 0; //DevInfo Initial. // //Call this function nConnectedDevNum = dsoHTSearchDevice(DevInfo); if (nConnectedDevNum > 0) { For(int i=0 ;i<32 i++)
{
if (DevInfo[i] = = 0) { // has device. The device is not used. } else if (DevInfo[i] = = 1) { // has device. The device is used. } else { //No device was found. }
}
}
2. DLL_API WORD WINAPI dsoHTDeviceConnect(WORD nDeviceIndex)
Return value:
If the device was connected is 1, otherwise is 0. Parameters: nDeviceIndex The device index. Remarks: Whether the device was connected.
Example:
WORD nDeviceIndex = 0: WORD nRe = 0; //Call the function nRe = dsoHTDeviceConnect(nDeviceIndex); if (nRe = = 1)
;//Connected
else
;//Not Connected
3. DLL_API BOOL WINAPI dsoSetUSBBus(WORD nDeviceIndex) Return value:
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.
Parameters: nDeviceIndex index of the device Remarks: If you change to USB communication, you must call this function firstly.
4. DLL_API BOOL WINAPI dsoGetDeviceSN(WORD DeviceIndex,UCHAR* pBuffer) Return value:
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.
Parameters: nDeviceIndex index of the device pBuffer Point to device serial string. Remarks: Before this operation, make sure that the device is connected successfully. By using it, obtain the serial number of device. Example: WORD nDeviceIndex = 0; UCHAR pBuffer[20]; //the minimum number of bytes is 20 memset(pBuffer,0,sizeof(pBuffer)); //initialize pBuffer
//Call this function if ( 0 = = dsoGetDeviceSN(nDeviceIndex, pBuffer) ) ;//Fail else ;//Succeed
5. DLL_API BOOL WINAPI dsoGetDriverVersion(WORD DeviceIndex,UCHAR* pBuffer) Return value:
Deault is 0, show the driver in the hardware belong to the first type of drive or the old drive..
When return 1, show the driver in the hardware belong to the second type of drive or the new driver. Parameters: nDeviceIndex index of the device pBuffer Point to device driver string. Remarks: Before this operation, make sure that the device is connected successfully. By using it, obtain the driver infomation of device. Example: WORD nDeviceIndex = 0; UCHAR pBuffer[20]; //the minimum number of bytes is 20 memset(pBuffer,0,sizeof(pBuffer)); //initialize pBuffer WORD nDriverCode = 0; //default is the old driver
//Call this function nDriverCode = dsoGetDriverVersion(nDeviceIndex, pBuffer);
6. DLL_API WORD WINAPI dsoHTSetCHPos(
WORD nDeviceIndex, WORD* pLevel, WORD nVoltDIV, WORD nPos, WORD nCH, WORD nDriverCode )
Return Value: If the function succeeds, the return value is zero. If the function fails, the return value is zero.
Parameters: nDeviceIndex index of the device pLevel pointer to calibration level. nVoltDIV index of channel nPos the position of channel, range: 0 ~ 255 (8bit)
Loading...
+ 11 hidden pages