Device for registration digital processing and synthesis of analog signals the sampling rate of which is uo to 100 MHz.
ADC100AS1
ADC 2õ12 bit, 80 MHz, DAC 9 bit, 80 MHz,
MASTER PCI 32/33
Programmer guide. "Target" and "Master" mode card work.
Work with  the card begins from its opening. (see function XdspOpenDevice). Before closing the supplement working with the card all the cards that were working need to be closed.  (see function XdspCloseDevice).
After opening the card you may chose the modes of its work (DAC memory signal generation permitted, apparatus interruption work mode, Receiving pointer for DMA buffer etc.).
Sampling process starting (input signal digitalising and output signal synthesis if this mode is on) is executed by the function XdspSampleStart. After calling the command XdspSampleStart the card goes to the input signal digitalising mode and its writing to the internal memory of the ADC. If signal generation from DAC memory is on (see functions XdspDACEnable, XdspDACDisable), then simultaneously with input signal digitalising the card synthesises the output signal the form of which is given by DAC memory. (Internal buffers of the synthesised and digitalised signals have the same dimensions: 256Ê notes).
When the internal memory is full the card sets a flag in the status register and generates apparatus interruption if it is permitted (see functions XdspSampleInterruptEnable, XdspSampleInterruptDisable). If the mode of executing DMA transaction is permitted then after the sampling process is finished(see functions XdspChainSampleDMAEnable, XdspChainSampleDMADisable) the card goes to the  DMA transaction mode of internal ADC memory copying to the DMA buffer of the PC. You can activate DMA transaction separately by calling the function XdspDMATransactionStart.
As in the sampling process after DMA transaction is finished the card sets a flag in the status register and generates interruption if it's permitted. (see functions XdspDMAInterruptEnable, XdspDMAInterruptDisable).
After sampling and DMA transaction processes are finished the digitalised input signal may be read in the "Master" mode through the pointer to DMA buffer (see function XdspGetDMABufferPtr). Then the received digitalised signal is processed. After this processing the sampling process, process of ADC memory reading and processing may be repeated cyclically. 

Let's see samples of working with the card:


"Master" mode signal digitalising with interruption permitted.

Basic sample text forDelphi:

// We connect the module with descriptions of constant values,types and imported functions   
Uses XdspAPI_DLL.pas;

Const
  ADCBufLen=262143;// Full volume of ADC buffer, 256K of double words

Var
  device0     : TDeviceHandle;          // Variable for device descriptor storage
  intr_hnd    : THandle;		// Variable for interruption waiting object descriptor storage 
  //  DMA buffer pointer, type PDmaMemoryBuffer is distinguished as pointer to the block of
  //  256Ê double words(maximum volume of the buffer sent by DMA transaction)
  dma_buffer : PDmaMemoryBuffer;

  signal_ch1  : Array[0..ADCBufLen] Of SmallInt; // Buffer for digitalised signal of the 1st channel
  signal_ch2  : Array[0..ADCBufLen] Of SmallInt; // Buffer for digitalised signal of the 2nd channel
  signals_sum : Array[0..ADCBufLen] Of SmallInt; // Buffer for the sum of 2 channels 
  i           : Integer;

//Procedure of opening and preparing of the card for work
Procedure XDSP_Device_Open;
Begin
  // Open card ¹0 and save its descriptor
  device0:=XdspOpenDevice(0);
  If device0=XDSP_INVALID_DEVICE_HANDLE Then ; // mistake processsing-informing the user etc.
  // Receive descriptor for waiting for interruption 
  result:=XdspGetInterruptEventHandle(device0,@intr_hnd);
  If result=XDSP_STATUS_ERROR Then ; // mistake processing - informing the user etc.
  // Receive poiter to DMA buffer
  result:=XdspGetDMABufferPtr(device0,@dma_buffer);
  If result=XDSP_STATUS_ERROR Then ; // mistake processsing-informing the user etc.
  // Permit automatic DMA transaction after the sampling process is finished
  result:=XdspChainSampleDMAEnable(device0);
  If result=XDSP_STATUS_ERROR Then ; // mistake processsing-informing the user etc.
  // Permit interruption generation after DMA transaction process is finished
  result:=XdspDMAInterruptEnable(device0);
  If result=XDSP_STATUS_ERROR Then ; // mistake processsing-informing the user etc.
  // Give dimensions of DMA transaction
  result:=XdspSetDMABufferLength(hndDrv,(ADCBufLen+1));
  If result=XDSP_STATUS_ERROR Then ; // mistake processsing-informing the user etc.
End;

//Card closing process
Procedure XDSP_Device_Close;
Begin
  // Close card with descriptor device0
  result:=XdspCloseDevice(device0);
  If result=XDSP_STATUS_ERROR Then ; // mistake processsing-informing the user etc.
End;

//Signal digitalising, ADC memory reading and channels sepatating procedure
Procedure XDSP_Device_Sample;
Begin
  // Start signal digitalising process with automatic DMA transaction
  result:=XdspResetAll;
  If result=XDSP_STATUS_ERROR Then ; // mistake processsing-informing the user etc.
  result:=XdspSampleStart;
  If result=XDSP_STATUS_ERROR Then ; // mistake processsing-informing the user etc.

  // Waiting for the end of digitalising process + DMA transaction (waiting for event on interruption, time-out 100 ms.)
  If WaitForSingleObject(intr_hnd,100)=WAIT_OBJECT_0 Then Begin
    // Interruption executed, we can work with the ADC memory presenting in the DMA buffer

    //  adc_mem data separating to two channels signal_ch1, signal_ch2
    For i:=0 To ADCBufLen Do Begin
      dwData:=dma_buffer^[i+1]; //  DMA buffer  block  begins with index 1
      signal_ch1[i]:=dwData;
      dwData:=dwData shr 16;
      signal_ch2[i]:=dwData;
    End;

  End Else Begin
    // Interruption received, mistake processing ...
  End;
End;

//Initialising the card, digitalising the signal and its processing
Begin
  XDSP_Device_Open; // Open and initialise the card

  // Cyclic process of digitalising the signal and its processing
  Repeat
    XDSP_Device_Sample; // Data digitalising,copying to adc_mem and separating to channels
    // Digitalised signals processing sample - summed signal of two channels calculating
    For i:=0 To ADCBufLen Do singals_sum[i]:=signal_ch1[i]+signal_ch2[i];
    // For example presenting or storaging the signals ...
  Until [exit conditions];

  XDSP_Device_Close; // Closing the card
End;




Forming synthesised signal presenting in the DAC memory  ("Target" mode).

Èñõîäíûé òåêñò ïðèìåðà äëÿ Delphi:

// Connect module with descriptions of constant values and of types of imported functions 
Uses XdspAPI_DLL.pas;

Const
  ADCBufLen=262143;// ADC buffer full volume, 256Ê bouble words

Var
  device0     : TDeviceHandle;         // Variable for storage of the descriptor of the device
  intr_hnd    : THandle;	       // Variable for storage of the descriptor of the objectof waiting for interruption 

  // Pointer to DMA buffer, type PDmaMemoryBuffer is distinguished as pointer to the block of 256Ê double words ( maximum volume of the buffer transmitted by DMA transaction)
  dma_buffer : PDmaMemoryBuffer;

  dac_signal  : Array[0..ADCBufLen] Of SmallInt; // Buffer for the storage of the synthesised signal presenting 
  signal_ch1  : Array[0..ADCBufLen] Of SmallInt; // Buffer for digitalised signal of the 1st channel
  signal_ch2  : Array[0..ADCBufLen] Of SmallInt; // Buffer for digitalised signal of the 2nd channel
  i           : Integer;

//Procedure of opening and preparing card for work
Procedure XDSP_Device_Open;
Begin
  // Open card ¹0 and save its descriptor
  device0:=XdspOpenDevice(0);
  If device0=XDSP_INVALID_DEVICE_HANDLE Then ; // mistake processsing-informing the user etc.
  
  // Get the descriptor for waiting for interruptuion
  result:=XdspGetInterruptEventHandle(device0,@intr_hnd);
  If result=XDSP_STATUS_ERROR Then ; // mistake processsing-informing the user etc.
  
  // Get the pointer to DMA buffer
  result:=XdspGetDMABufferPtr(device0,@dma_buffer);
  If result=XDSP_STATUS_ERROR Then ; // mistake processsing-informing the user etc.
  
  // Permit automatic DMA transaction when the sampling process is finished
  result:=XdspChainSampleDMAEnable(device0);
  If result=XDSP_STATUS_ERROR Then ; // mistake processsing-informing the user etc.
  
  // Permit interruption generation when the DMA transaction process is finished
  result:=XdspDMAInterruptEnable(device0);
  If result=XDSP_STATUS_ERROR Then ; // mistake processsing-informing the user etc.
  // Give the dimensions of DMA transaction
  result:=XdspSetDMABufferLength(hndDrv,(ADCBufLen+1));
  If result=XDSP_STATUS_ERROR Then ; // mistake processsing-informing the user etc.
End;

Procedure XDSP_Device_Close;
Begin
  // Close card with  device0 descriptor
  result:=XdspCloseDevice(device0);
  If result=XDSP_STATUS_ERROR Then ; // mistake processsing-informing the user etc.
End;

//Procedure of writing the synthesised signal presenting to the DAC memory
Procedure XDSP_Write_DAC_Memory;
Begin
  result:=XdspResetAll;
  If result=XDSP_STATUS_ERROR Then ; // mistake processsing-informing the user etc.

  // DAC memory access in "Target" mode permitted
  result:=XdspTargetModeEnable(device0);
  If result=XDSP_STATUS_ERROR Then ; // mistake processsing-informing the user etc.

  //  writing data from dac_signal block to the DAC memory
  For i:=0 to ADCBufLen Do Begin
    dwResult:=XdspWriteDACMemDWORD(device0,i,dac_signal[i]);
  End;

  // DAC memory access in "Target" mode banned
  result:=XdspTargetModeDisable(device0);
  If result=XDSP_STATUS_ERROR Then ; // mistake processsing-informing the user etc.
End;

//Signal digitalising,ADC memory reading and channel separating process
Procedure XDSP_Device_Sample;
Begin
  //Start the signal digitalising process with automatic DMA transaction
  result:=XdspResetAll;
  If result=XDSP_STATUS_ERROR Then ; // mistake processsing-informing the user etc.
  result:=XdspSampleStart;
  If result=XDSP_STATUS_ERROR Then ; // mistake processsing-informing the user etc.

  // Waiting for the end of the digitalising process  + DMA transaction(waiting for event on interruption, time-out 100 msñ.)
  If WaitForSingleObject(intr_hnd,100)=WAIT_OBJECT_0 Then Begin
    // Interruption received, can work with ADC memory presenting in the DMA buffer 

    //  adc_mem data separating to two channels signal_ch1, signal_ch2
    For i:=0 To ADCBufLen Do Begin
      dwData:=dma_buffer^[i+1]; //  DMA buffer block begins with index 1
      signal_ch1[i]:=dwData;
      dwData:=dwData shr 16;
      signal_ch2[i]:=dwData;
    End;

  End Else Begin
    // Interruption not received, mistake processing ...
  End;
End;

//Initialising the card,DAC output permission, signal digitalising and processing
Begin
  XDSP_Device_Open; // Open and initialise the card

  //  forming of the synthesised signal presenting in the block dac_signal
  For i:=0 To ADCBufLen Do Begin
    dac_signal[i]:=512+256+Trunc(255*sin(i*Pi/180)); // sinus with 0 level 256 and 255 range 
  End;

  // Synthesised signal presenting storage to the DAC memory
  XDSP_Write_DAC_Memory;

  // Signal synthesis permission
  result:=XdspDACEnable(device0);
  If result=XDSP_STATUS_ERROR Then ; // mistake processsing-informing the user etc.

  // Cyclic process of sampling and processing of the digitalised signal
  Repeat
    XDSP_Device_Sample; // Data digitalising, copying to adc_mem and separating to channels
    // For example processing presenting or storage of the signals...
  Until [exit condition];

  XDSP_Device_Close; // close the card
End;

Home | Back | Go