Hantek DDS-3005 SDK manual

DDS-3005 USB SDK manual
#define INT_TRIG_EN 0x00 //Intramural trigger #define START_OUTPUT 0x00 // Start output #deine STOP_OUTPUT 0x10 //Stop output
#define FRQ_TEST 0x00 /Frequency test state #define COUNTER 0x80 //Counter state #define COUT_LATCH 0x00 // F #define COUT_NOT LATCH 0x40 //Output latch __declspec(dllimport) BOOL WINAPI SetCON(unsigned char d,int index);
Parameters introductiond unsigned 8 bits integer. Index device number to operate Return valueIf return true, it express successful setup, else express failing setup. ExampleBOOL Flag; Flag=SetCON(CONSTANT_WAVE|
EXT_FALLING_TRIG| INT_TRIG_EN|
FRQ_TEST| COUT_NOT LATCH,0); Note:The hardware of signal controls the state of signal set by 8
bits control memoryBit7 to Bit0. Bit0
2
DDS-3005 USB SDK manual
If return 1, it express output waveform is single waveformThe trigger touch off one single waveform every time。If isn’t single, the voltage will hold the state of last sample. If return 0, it express output continuous. If be touched off (From inside or exterior), it will output periodic waveform hour after hour.
Bit1 If return 1, it express to appear raising trigger.
If return 0, it express to appear falling trigger. Bit2 If return 1, it express to external trigger work. If return 0, it express to intramural trigger work. Bit3hold Bit4 If return 0, it express to start wave output. If return 1, it express to stop waveform output and wait for trigger.
Bit5hold
Bit6 If return 0, it express to frequency counter’s output latch
then counter signal.
If return 0, it express to connect directly. If the counter
works, it should first be latch then read, last latch.
Bit7 If return 0, it express state that the frequency test, reset
frequency counter.
If return 1, it express the counter works , being not effected
by intramural gating signal.
3
DDS-3005 USB SDK manual
2 8 bits digital I/O control
__declspec(dllimport) BOOL WINAPI DigitalInOut(unsigned char d,unsigned char *o,int index);
Parametersd 8 bits unsigned integerexpress 8 bits output I/O
Index device number to operate
Value:
O point to 8 bits unsigned integer pointer, saving the
8 bits I/O result to the address.
Return value:If return true ,it express successful operation,else express failing operation. ExampleBOOL Flag; Unsigned char OutVal=0xaa; Unsigned char InVal; Flag= DigitalInOut(OutVal,&InVal,0);
3 Set frequency of output sample point
__declspec(dllimport) BOOL WINAPI SetAD9850(unsigned long d,int index);
Parametersd unsigned long integer. Index device number to operate Return value:If return true ,it express successful operation,else express failing operation. ExampleBOOL Flag; Unsigned Long FrqVal=10000;
4
DDS-3005 USB SDK manual
Flag= SetAD9850 (FrqVal ,0); Note: Set out frequency of sample point is F, d is 32 bits parameter, then: F=100 * d / 4294967296 MHz
4 Set relay state
//optional parameters #define MASK_FIR_NOT_5M 0x01 //Filter cut-off frequency less than 5M #define MASK_FIR_PAS_5M 0x02 //Filter cut-off frequency is 5M #define MASK_AMP_D15FU 0x10 //Waveform normal scope #define MASK_AMP_N10DB 0x20 //Waveform output attenuate 20dB #define MASK_OUT_HZ 0x04 //Output closed #define MASK_OUT_EN 0x08 //Output opened #define MASK_COP_AC 0x40 /Input frequency AC coupling #define MASK_COP_DC 0x80 //Input frequency DC coupling __declspec(dllimport) BOOL WINAPI SetRelay(unsigned char d,int index);
ParametersD 8 bits unsigned integer
Index device number to operate
5
DDS-3005 USB SDK manual
Return value:If return true ,it express successful operation,else express failing operation. ExampleBOOL Flag;
Flag= SetRelay(MASK_OUT_EN,0 );
Note: There are four Relays in the signal fountain, control them
by value in optional parameters. This operation will cost 100ms, that is the filter execute time.
5 Select frequency counter input
//optional parameters #define FRQ_DC_20M 0x01 /Select low frequency input #define FRQ_10M_2700M 0x00 //Select high frequency input __declspec(dllimport) BOOL WINAPI SetFinSource(unsigned char d,int index );
Parameters: d 8 bits unsigned integer
Index device number to operate. Return value:If return true ,it express successful operation,else express failing operation. ExampleBOOL Flag;
Flag= SetFinSource (FRQ_10M_2400M ,0);
Note: There are two interface of signal input, one is high
frequency input (10 to 2.7GHz), another is low frequency input(DC to 20M).
6
DDS-3005 USB SDK manual
6 Reset counter and startup frequency one time test
__declspec(dllimport) BOOL WINAPI StartFrqMeasure(int index );
Parameters: Index device number to operate Return value:If return true ,it express successful operation,else express failing operation. ExampleBOOL Flag;
Flag= StartFrqMeasure(0);
Note: When it works in the frequency test state, it reset
counter and bring one time intramural gating signal. The signal persists 1000ms, and carry through frequency counter. When it is the counter state, the function only reset the counter.
7 Set address counter’s last address
__declspec(dllimport) BOOL WINAPI SetEndAddr(unsigned long d,int index);
Parameters d unsigned long integer. Index device number to operate Return value:If return true ,it express successful operation,else express failing operation. ExampleBOOL Flag; Unsigned Long AddrVal=10000; Flag= SetEndAddr (AddrVal,0 );
7
DDS-3005 USB SDK manual
Note: There is a 256K unit of 16 bit width in the signal fountain.
So the address of end area is from 0000H to 3FFFF.This function should execute before send the waveform data to signal set. After that, reset address counter and stop it. Wait for the user sending over the data.
8 Set output filter cut-off frequency
//optional parameter #define FIR_1K 0x00 #define FIR_10K 0x02 #define FIR_100K 0x01 #define FIR_1M 0x03 __declspec(dllimport) BOOL WINAPI SetFir(unsigned char d,int index);
Parameter d 8 bits unsigned integer. Index device number to operate Return value If return true ,it express successful operation else express failing operation. Example BOOL Flag;
Flag= SetFir (FIR_10K, 0); Note No other than the relay is set to output filter cut-off
frequency that is less 5MHz, the function exerts operation. Otherwise it will is still 5MHz, cut-off frequency is not effected by functions setting.
8
DDS-3005 USB SDK manual
9 Clear the address counter and start
__declspec(dllimport) BOOL WINAPI FrameNegtivePulse(int index );
Paramemter: Index device number to operate
ResultIf return true ,it express successful operationelse express failing operation. ExampleBOOL Flag;
Flag= FrameNegtivePulse(0);
NoteThe function should be use after transfer Wave form data to inside of the signal fountain. After the function that set address counter’s last address is used, the address counter has stopped and waited for program carry data of waveform to signal RAM. When transfer stop, function is used and start address counter again and send the signal fountain output waveform.
10 Read the value of the counter.
__declspec(dllimport) unsigned long WINAPI GetFrqMeasureResult(int index);
Parameter: Index device number to operate resultThe value of the counter. exampleLong CounterVal;
CounterVal= GetFrqMeasureResult (0);
NoteWhen you are testing frequency ,the function should be
use after starting one time frequency test for 1000ms,When the counter is working, the function should
9
DDS-3005 USB SDK manual
be use after enable the flip-latch of the counter. Then Unable the flip-latch of the counter.
11 Transfers Wave form data to the signal fountain
__declspec(dllimport) BOOL WINAPI SendDataPackage64(unsigned char *d,unsigned int n,int index );
Parameterd waveform buffer the first pointer. n the number of bits in the waveform buffer. Index device number to operate Result If return true ,it express successful operation,else express failing operation. Example Unsigned char Buf[200]; FlagSetAD9850 (1000000); //Set the rate of renovation for(int i=0;i<100;i++) //Compute one cycle sine wave
form { unsigned int Temp = (unsigned int)(8192 + 8000 *
sin(i * 3.14159265 * 2 / 100)); Buf[2 * i] = Temp % 256; Buf[2 * i + 1] = Temp / 256; } SetEndAddr (99); //Setting the last address of
the address counter
SendDataPackage64(Buf, 200,0); //Transfers Waveform
10
DDS-3005 USB SDK manual
data to RAM of the signal fountain.
FrameNegtivePulse(0); //Clear the address
counter and start work.
Note:One sample point has two bytes,but the efficiency width are 14 bits. The value is relation of linearity with the output voltage. 0000H is correspond with -10V 3FFFH is correspond with +10V.The low 8 bits of every sample point are save at low address of the buffer. The high 8 bits of every sample point are save at high address of the buffer. The samples give us a program that transfers 100 points to the signal fountain.
If the return of the interface function is False, it express the communication with USB interface is failed. User can use the interface functions reference the samples of many languages.
12 Read Address
__declspec(dllimport) BOOL WINAPI Read24C01(unsigned char Addr,unsigned int *Dat,int index);
Parameters:
addr:the pipe number to operator Dat the buffer for receive data. Index device number to operate
Result If return true ,it express successful operation,else express failing operation. Example unsigned int temp;
11
DDS-3005 USB SDK manual
If(!Read24C01(0,&temp,0)
MessageBox(¡°Read Error!¡±);
Else
MessageBox(¡°Read OK!¡±);; Note: Read Address.
13 Write Address
__declspec(dllimport) BOOL WINAPI Write24C01(unsigned char Addr,unsigned int Dat,int index)
Parameters: addr:the pipe number to operate Dat the buffer for sending out data. Index Device number to operate
Result If return true ,it express successful operation,else
express failing operation.
Example
Unsigned int buf; If(Read24C01(0,buf,0))
MessageBox(¡°Write OK¡±);
Else
MessageBox(¡°Write Error!¡±) Note: Write Address.
14 Initialize USB Device
__declspec(dllimport) int WINAPI GetItemNum(int *addr,int
12
DDS-3005 USB SDK manual
&len);
Parameters:addr array for device index
Len the length of add Result If return 0, it express successful operation.
If return 1, express failing operation. Example Int addr[127],len; Int res=GetItemNum(addr,len); If(res==0) { Return OK;
}
Else
{
Return ERROR;
} Note: initialize all devices, and get the number of devices. You must call this function before operation.
13
Loading...