Measurement-computing Data Acquisition Systems rev.10.4 Manual de usuario Pagina 32

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 366
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 31
2-22 API Programming, General Models 988594 Programmer’s Manual
Now configure the Daq device with this information, and read 5 scans of data:
Dim chans&(4), gains&(4), buf%(20)
handle& = VBdaqOpen&(“DaqBook0”)
' Set array of channels and gains
chans&(0) = 0
gains&(0) = DgainX1&
chans&(1) = 1
gains&(1) = DgainX2&
chans&(2) = 2
gains&(2) = DgainX2&
chans&(3) = 3
gains&(3) = DgainX2&
' Load scan sequence FIFO :
ret& = VBdaqAdcSetScan&(handle&, chans&(), gains&(), 4)
' Set Clock
ret& = VBdaqAdcFreq&(handle&, 10)
' Define and arm trigger :
ret& = VBdaqAdcSetTrig&(handle&, DtsSoftware&, 0, 0, 0, 0)
' Trigger
ret& = VBdaqAdcSoftTrig&(handle&)
' Read the data
‘ 5 indicates the number of scans
‘ single mode for scans less than 500
ret& = VBdaqAdcTransferSetBuffer&(handle&, buf%(), 5, DatmCycleOff& +
DatmSingleMode&)
ret& = VBdaqAdcTransferStart&(handle&)
‘specifies to wait for the transfer to be complete
ret& = VBdaqWaitForEvent&(handle&, DteAdcDone&)
ret& = VBdaqAdcTransferGetStat&(handle&, active&, retCount&)
' Print the first scan of unconverted data
PRINT "Before Calibration:"
PRINT "Channel 0 at x1 gain: "; buf%(0)
PRINT "Channel 1 at x2 gain: "; buf%(1)
PRINT "Channel 2 at x2 gain: "; buf%(2)
PRINT "Channel 3 at x2 gain: "; buf%(3)
'Perform zero compensation on readings sampled at x1 gain
ret& = VBdaqCalSetupConvert&(handle&, 4, 0, 1, 0, DgainX1&, 0, 1, 0, buf%(),
5)
'Perform zero compensation on readings sampled at x2 gain
ret& = VBdaqCalSetupConvert&(handle&, 4, 1, 3, 0, DgainX2&, 1, 1, 0, buf%(),
5)
' Print the first scan of converted data
PRINT "After Calibration:"
PRINT "Channel 0 at x1 gain: "; buf%(0)
PRINT "Channel 1 at x2 gain: "; buf%(1)
PRINT "Channel 2 at x2 gain: "; buf%(2)
PRINT "Channel 3 at x2 gain: "; buf%(3)
Vista de pagina 31
1 2 ... 27 28 29 30 31 32 33 34 35 36 37 ... 365 366

Comentarios a estos manuales

Sin comentarios