WXG-DAQ-1G Data Acquisition Card API Interface Documentation

Tags:

PCIe7820-API DLL Interface Function Description

simple introduction

PCIe-7820 has built-in IQ demodulation function for balanced detector DAS system, which supports both single-channel IQ demodulation and dual-channel IQ demodulation. The upload rate can be configured as 1G, 500M, 250M, 125M, 83.33M, 62.5M, 50M, etc. The PCIe-7820 supports single-channel, dual-channel and quad-channel;

Supports three data upload modes: single-channel, dual-channel and quad-channel. When using single-channel mode, the maximum number of points per frame (the number of points collected by a single trigger pulse) can support 262144 points, i.e., the length of a single optical fibre can reach a maximum of 262144*0.1m=26.2144km under the uploading rate of 1G (0.1m spatial resolution); longer optical fibre lengths can be supported if the uploading rate is lowered;

int pcie7820_open ()

/*****************************************************************/ 

Function Description

Open the device

Function Parameters

    NO

Function Return Value

Success, return 0

Failure, return -1

/*****************************************************************/

 void pcie7820_close ()

/*****************************************************************/

Function Description

close the device

Function Parameters

NO

Function Return Value

NO

/*****************************************************************/

 

int pcie7820_set_trig_dir(unsigned int trig_dir)

/*****************************************************************/

Function Description

Setting the trigger pulse direction

Function Parameters

      trig_dir  :0---Receive Trigger Pulse1--- Send trigger pulse                    

Function Return Value

Success0  

       Failure-1

/*****************************************************************/

 

int pcie7820_set_scan_rate (double scan_rate)

/*****************************************************************/

Function Description

Sets the scan rate, i.e. the frequency at which the board outputs trigger pulses. When set to trigger input (receive external trigger pulse), this function can not be called.

Function Parameters

        scan_rate :Scan rate in Hz;

 Function Return Value

Success,0

Failure,-1

/*****************************************************************/

 

int pcie7820_set_pusle_width (unsigned int pulse_high_width_ns)

/*****************************************************************/

Function Description

Sets the width of the high level of the trigger pulse. This function can not be called when it is set to trigger input (receiving an external trigger pulse).

Function Parameters

       pulse_high_width_ns The unit is ns, an integer multiple of 4ns, with a minimum value of 4ns.

Function Return Value

Success,0

Failure,-1

/*****************************************************************/

 

int pcie7820_set_upload_data_param(unsigned int upload_ch_num,unsigned int upload_data_src,unsigned int upload_data_rate)

/*****************************************************************/

Function Description

Set up the board upload data parameters. Digital downconversion has been done on the board to perform digital I/Q demodulation of the captured data. The upload_ch_num parameter and upload_data_src are used together to select which position in the demodulation algorithm to read the data at.

 图片1.png

Figure 3.2 Digital quadrature demodulation flow


Function Parameters

upload_ch_num  :Sets the number of upload channels;

1 - upload one channel of data; 2 - upload two channels of data; 4 - upload four channels of data;

upload_data_src :Upload data source selection;

0 - upload raw acquisition data; 2 - upload IQ data; 3 - upload phase and magnitude data;

upload_data_rate :Setting the upload data rate;

1---1GSps;2---500MSps;4---250MSps;8---125MSps;12---83.333MSps; 16---62.5MSps;20---50MSps;24---41.66MSps;28---35.714MSps;

32---31.25MSps;

Function Return Value

Success,0

Failure,-1

pcie7820_read_data The data read by the function should be parsed according to the following table:

 

NO.upload_ch_numupload_data_srcUploaded dataParsing rules for uploaded data
110Raw data collected on channel 0ch0_raw_data---  ch0_raw_data --- ch0_raw_data --- ch0_raw_data---
212I-way data after low-pass filter on channel 0I0---I0----I0---I0……
313Channel 0 demodulated phase dataarctan(Q0/I0)--- arctan(Q0/I0)--- arctan(Q0/I0)--- arctan(Q0/I0)---
420Raw data collected on channels 0 and 1ch0_raw_data---ch1_raw_data ---    ch0_raw_data ---    ch1_raw_data ……
522I and Q data of channel 0 after low-pass filteringI0---Q0---I0----Q0……
623Channel 0 demodulated phase and amplitude dataarctan(Q0/I0)--- √(I02+Q02)--- arctan(Q0/I0)--- √(I02+Q02) …
740unsupportedunsupported
842I and Q data of channels 0 and 1 after low-pass filteringI0---Q0---I1----Q1---I0---Q0---I1----Q1……
943Phase and amplitude data after demodulation of channels 0 and 1arctan(Q0/I0)--- √(I02+Q02)--- arctan(Q1/I1)--- √(I12+Q12)--- arctan(Q0/I0)--- √(I02+Q02)--- arctan(Q1/I1)--- √(I12+Q12) …

 

ch0_raw_data---ch1_raw_data---I0---Q0---I1----Q1--- arctan(Q0/I0)--- arctan(Q1/I1),These 8 types of data need to be parsed as 16-bit signed data (short).; √(I02+Q02)--- √(I12+Q12),Both types of data need to be parsed as 16-bit unsigned short.

 

The arctan phase value read up is a fixed point value, and its correspondence with π is: 25735 - positive π , -25735 - negative π

 /*****************************************************************/

 

int pcie7820_set_points_num_per_scan(unsigned int point_num_per_scan)

 /*****************************************************************/

Function Description

Set the number of points per channel to be captured for each trigger pulse.

Function Parameters

point_num_per_scan  :The number of points to be captured per channel;

In single-channel mode, this parameter must be an integer multiple of 512, with a maximum number of points of 262144;

In dual-channel mode, the parameter must be an integer multiple of 256, with a maximum number of points of 131072;

In four-channel mode, the parameter must be an integer multiple of 128, with a maximum number of points of 65536;

Function Return Value

Success,0

Failure,-1

/*****************************************************************/

 

int pcie7820_set_center_freq(unsigned int center_freq_hz)

/*****************************************************************/

Function Description

If you use the IQ demodulation function, you need to set the centre frequency of the signal; for systems with 80M frequency shift of the acousto-optic modulator, the parameter can be set to 80000000; for systems with 200M frequency shift of the acousto-optic modulator, the parameter can be set to 200000000

Function Parameters

center_freq_hz The centre frequency of the acquired signal in Hz;  

Function Return Value

Success,0

Failure,-1

/*****************************************************************/

 

int pcie7820_point_num_per_ch_in_buf_query(unsigned int *p_point_num_in_buf_per_ch)

 /*****************************************************************/

Function Description

Query the number of data points per channel in the cache

Function Parameters

p_point_num_in_buf_per_ch : Number of data points per channel in the cache

Function Return Value

Success,0

Failure,-1

/*****************************************************************/

  int pcie7820_read_data(unsigned int point_num_per_ch,short *p_raw_data, unsigned int *p_points_per_ch_returned)

/*****************************************************************/

Function Description

read data

Function Parameters

point_num_per_ch The number of points read per channel, which must be an integer multiple of 512 in single-channel mode, an integer multiple of 256 in dual-channel mode, and an integer multiple of 128 in quad-channel mode.

This parameter must be 512 integer times in single-channel mode, 256 integer times in dual-channel mode, and 128 integer times in quad-channel mode; it is recommended to read at least 512*point_num_per_scan points at a time to increase the utilisation of the PCIe bus for data transfer.

p_raw_data Pointer to the read data buffer;

In single-channel mode, the buffer length represented by this pointer is point_num_per_ch;

In dual-channel mode, the buffer length represented by this pointer is point_num_per_ch*2;

in quad-channel mode, the buffer length represented by this pointer is point_num_per_ch*4;

Please refer to the table in the pcie7820_set_upload_data_param function location for the parsing method of the read data.

p_points_per_ch_returned Number of actual readings per channel

Function Return Value

Success,0

Failure,-1

/*****************************************************************/

 

int pcie7820_start (void)

/*****************************************************************/

Function Description

Start collecting

Function Parameters

 NO

Function Return Value

Success,0

Failed. Negative.

/*****************************************************************/

 

int pcie7820_stop (void)

/*****************************************************************/

Function Description

Failed. Negative.

Function Parameters

NO

Function Return Value

Success,0

Failed. Negative.

/*****************************************************************/