LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you initialize a PXI-5661 for multiple records?

I have a PXI-5661.
To gain more speed acquiring data, I am investigating the use of niRFSA_FetchIQMultiRecordComplexF64.
Can someone provide sample code on first setting up the proper parameters to perform the FetchIQ?
How do you use the channel list variable?
And how do you unravel the data once a finite number of records has been captured?
 
Thanks.
 
0 Kudos
Message 1 of 2
(3,266 Views)
Hello Ewjammer,

Multirecord IQ acquisition will work similar to one record example called "GettingStartedIQ" in C and CVI examples.
You will need to change basically the amount of memory you want to reserve and your waveform info now will have more parameters. Here would be the example of the modified acquisition section of the code:

ViStatus status;
   ViInt32 numberOfSamples, numRecords;
   ViReal64 timeout = 10;
   int i;
   
   /* waveforms */
   NIComplexNumber* dataPtr = NULL;
   ViReal64* IDataPtr = NULL;
   ViReal64* QDataPtr = NULL;
   niRFSA_wfmInfo* wfmInfo;
   
   /* get the number of samples specified by user    */
   GetCtrlVal (gui, GUI_SAMPLES_PER_RECORD, &numberOfSamples);
   GetCtrlVal (gui, GUI_NUM_RECORDS, &numRecords);
   
   /* allocate memory for the data */
   dataPtr =  malloc  (sizeof (NIComplexNumber) * numberOfSamples * numRecords);
   IDataPtr = malloc (sizeof (ViReal64) * numberOfSamples * numRecords);
   QDataPtr = malloc (sizeof (ViReal64) * numberOfSamples * numRecords);
   wfmInfo  = malloc (sizeof (niRFSA_wfmInfo) * numRecords);
   
   checkWarn (
      niRFSA_Initiate (session));
   
   checkWarn (
      niRFSA_FetchIQMultiRecordComplexF64 (session, "0", 0, numRecords,
                                           numberOfSamples, 10, dataPtr, wfmInfo));
   
   /* get the I and Q data from the complex number array    */
   for (i = 0; i < (numberOfSamples * numRecords); ++i)
   {
      IDataPtr[i] = dataPtr[i].real;
      QDataPtr[i] = dataPtr[i].imaginary;
   }



And from the help file you see that the waveforms (records) come sequentially:

NIComplexNumber* Returns the acquired waveform for each record fetched. The waveforms are written sequentially in the array. Allocate an array at least as large as numberOfSamples times numberOfRecords for this parameter.


Hope this helps,
Gerardo O.
RF SW Engineering R&D
National Instruments
0 Kudos
Message 2 of 2
(3,240 Views)