BNC 645 User Manual

Page 187

Advertising
background image

187

triggers

.Output = "Init" ' Place dmm in 'wait-for-trigger' state

.Output = "*OPC" ' Set 'operation complete' bit in standard

' event registers when measurement is complete

End With

'""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

' enable the timer to poll gpib once per second

tmrPollForSRQ.Enabled = True

' give message that meter is initialized

' give message that configuration is done

txtData.Text = "Meter configured and " & vbCrLf & _

"Initialized"

Exit Sub

StartReadingsError:

Debug.Print "Start Readings Error = "; Err.Description

End Sub

Private Sub tmrPollForSRQ_Timer() 'Timer1

' This timer when enabled will poll the GPIB

' and return the status byte to indicate if SRQ is set

On Error GoTo pollerror

Continued on next page

' this will also change the timeout

statusValue = Model 645.WaitOnSRQ(100)

' WaitOnSRQ(100ms)

' Set the timeout back to 10 sec,

Model 645.TimeOut = 10000

If statusValue = 64 Then ' SRQ from Operation complete

' Turn off the timer and stop polling.

tmrPollForSRQ.Enabled = False

Debug.Print "SRQ is set, getting data"

' Get the Data, the meter is ready

ReadData

End If

Exit Sub

pollerror:

Debug.Print "No SRQ yet, Poll error = "; Err.Description

End Sub

Private Sub ReadData()

' Once the SRQ is detected, this routine will

' get the data from the meter

' Called by: PollForSRQTimer_Timer

'

Dim readings() As Double

Dim i As Long

On Error GoTo ReadDataError

' dimension the array for the number of readings

With Model 645

.Output = "Fetch?" ' Query for the data in memory

readings = .Input ' get the data and parse into the array

End With

Advertising