Measurement-computing TempBook rev.3.0 Instrukcja Użytkownika Strona 122

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 166
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 121
10-26
Enhanced
API Programming Models (TempBook) TempBook Users Manual
Transfers With Driver-Allocated Buffers
This example demonstrates the use of the new
daqAdcTransferBufData()
function. The following program
reads scans of multiple channels in the background mode and uses a
software trigger to start the acquisition. Functions used include:
VBdaqAdcArm&(handle&)
VBdaqAdcSetAcq&(handle&, DaamNShot&, 0, scans&)
VBdaqAdcSetFreq&(handle&, freq#)
VBdaqAdcSetMux&(handle&, 1, channels&, DgainX1&,
1)
VBdaqAdcSetTrig&(handle&, DatsSoftware&, 0,0,0,0)
VBdaqAdcSoftTrig&(handle&)
VBdaqAdcTransferBufData(handle&, userBuf(0), 1,
DatmWait , retVal)
VBdaqAdcTransferGetStat(handle, active, retCount);
VBdaqAdcTransferSetBuffer(handle&, buf%(), scans&,
DatmCycleOff& + DatmUpdateSingle&)
VBdaqAdcTransferStart(handle&)
VBdaqClose(handle&)
VBdaqOpen("TempBook0")
VBdaqSetErrorHandler(handle&, 100)
The constants used are defined as follows:
Const channels& = 8
Const scans& = 9
Const freq# = 200
As usual, the device is opened and the error handler is set up:
handle& = VBdaqOpen("TempBook0")
ret& = VBdaqSetErrorHandler(handle&, 100)
On Error GoTo ErrorHandlerADC4
The acquisition is configured for 9 post-trigger scans and
Nshot
mode:
ret& = VBdaqAdcSetAcq&(handle&, DaamNShot&, 0,
scans&)
Set up the scan configuration for channels 1 to 9 with a gain of ×1:
ret& = VBdaqAdcSetMux&(handle&, 1, channels&,
DgainX1&, 1)
Set the post-trigger scan rates:
ret& = VBdaqAdcSetFreq&(handle&, freq#)
Set the trigger source to a software trigger command; the other trigger parameters are not needed with a
software trigger.
ret& = VBdaqAdcSetTrig&(handle&, DatsSoftware&, 0,0,0,0)
Now to set up the buffer for a background acquisition, in update single mode with cycle mode off.
ret& = VBdaqAdcTransferSetBuffer(handle&, buf%(), scans&, DatmCycleOff& +
DatmUpdateSingle&)
Start the transfer, and trigger to begin transferring data:
ret& = VBdaqAdcTransferStart(handle&)
Arm the acquisition:
ret& = VBdaqAdcArm&(handle&)
Trigger the transfer:
ret& = VBdaqAdcSoftTrig&(handle&)
Monitor the progress of the background transfer:
VBdaqAdcTransferGetStat(handle, active, retCount);
retCount=1;
while retCount<>0 do
VBdaqAdcTransferBufData(handle&, userBuf(0), 1, DatmWait , retVal)
print"Transfer in progress: ,retCount, scans acquired."
for i=0 to CHANS
Przeglądanie stron 121
1 2 ... 117 118 119 120 121 122 123 124 125 126 127 ... 165 166

Komentarze do niniejszej Instrukcji

Brak uwag