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

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 166
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 118
TempBook Users Manual
Enhanced
API Programming Models (TempBook) 10-23
Direct-to-Disk Transfers
This example takes multiple scans from multiple channels and writes
them directly to disk in a packed-data format. Functions used are:
VBdaqAdcArm&(handle&)
VBdaqAdcSetAcq&(handle&, DaamNShot, 0, scans&)
VBdaqAdcSetDiskFile&(handle&, "adcex8.bin",
DaomAppendFile&, 0)
VBdaqAdcSetFreq&(handle&, freq!)
VBdaqAdcSetMux&(handle&, 1, channels&, DgainX1&,
DafUniPolar&+DafAnalog&)
VBdaqAdcSetTrig&(handle&, DatsSoftware&,
DatdRisingEdge&, 0, HYSTERESIS%, 1)
VBdaqAdcSoftTrig&(handle&)
VBdaqAdcTransferGetStat&(handle&, active&,
retCount&)
VBdaqAdcTransferSetBuffer&(handle&, buf%(),
BLOCK&, DatmCycleOn& + DatmUpdateBlock&)
VBdaqAdcTransferStart&(handle&)
VBdaqClose&(handle&)
VBdaqCvtRawDataFormat&(buf%(), DacaUnpack, BLOCK&,
channels&, scanCount&)
VBdaqOpen&("TempBook0")
VBdaqSetErrorHandler(handle&, 100)
File handling in MS-Windows requires calls to the windows API, so the
following constants are defined for use in those calls. For further
information, see
mapiwin.h
.
Const GENERIC_READ& = &H80000000
Const OPEN_EXISTING = 3
Const FILE_ATTRIBUTE_NORMAL& = &H80
Const OPEN_ALWAYS = 4
Const CREATE_ALWAYS = 2
Also define the usual constants defining scan parameters and some
declarations for file manipulation:
Const channels& = 2
Const scans& = 800
Const freq! = 200#
Const BLOCK& = 200 ' CHANNELS& * BLOCK& must be
a multiple of 4
Const HYSTERESIS% = 0
Dim buf%(channels& * BLOCK&)
Dim fileHandle&
Dim byteCount&, wordCount&, sampleCount&,
scanCount&
Dim binFile$
First set the name of the file to be used for the acquisition:
binFile = "adcex8.bin"
Open the device, and set the error handler:
handle& = VBdaqOpen&("TempBook0")
ret& = VBdaqSetErrorHandler(handle&, 100)
On Error GoTo ErrorHandlerADC8
Set the acquisition to
NShot
on trigger and the post-trigger scan count:
ret& = VBdaqAdcSetAcq&(handle&, DaamNShot, 0, scans&)
Set the scan configuration for channels 1 to 8 with a gain of ×1 in unipolar analog mode:
ret& = VBdaqAdcSetMux&(handle&, 1, channels&, DgainX1&,
DafUniPolar&+DafAnalog&)
Set the post-trigger scan frequency:
ret& = VBdaqAdcSetFreq&(handle&, freq!)
Przeglądanie stron 118
1 2 ... 114 115 116 117 118 119 120 121 122 123 124 ... 165 166

Komentarze do niniejszej Instrukcji

Brak uwag