beautypg.com

ETS-Lindgren 2090 Controller User Manual

Page 92

background image

Using the GPIB Command Set with the Model 2090

Model 2090 Multi-Device Controller

ibwrite Tower%, "LV 200" ' Set lower vertical limit
TowerEdit.Text = "Polar Violation" ' Inform user of status
ibwrite Tower%, "PV" ' Generate Polarization Violation
' Error by polarizing vertically

'
' Generate an Execution Error
'
TowerEdit.Text = "Execution Error" ' Inform user of status
ibwrite Tower%, "UL 50" ' Setting upper limit < lower limit
' will cause an execution error

'
' Generate a Command Error
'
TowerEdit.Text = "Command Error" ' Inform user of status
ibwrite Tower%, "Bad command" ' Generate a Command Error

'
' Generate a Query Error
'
ibtmo Tower%, T100ms ' Reduce the GPIB timeout
TowerEdit.Text = "Query Error" ' Inform user of status
ibread Tower%, Read$ ' Generate Query Error by reading
' from the controller when it has
' nothing to say.

TowerEdit.Text = GetCurrentPosition(Tower%) ' Show current position

'
' Clean up before quitting
'

ibwrite Tower%, "ST" ' Stop tower
ibonl Tower%, 0 ' Free tower's GPIB port




'
' This function will return the current position of the specified device.
'
Function GetCurrentPosition(device%) As Single
Dim Read$
Read$ = Space$(20) ' Initialize a buffer
ibwrite device%, "CP?" ' Query device current position
ibread device%, Read$ ' Read response
GetCurrentPosition = Val(Read$) ' Return value
End Function



'
' This function handles service requests detected during reads.
' The GPIB card must be configured for Auto Serial Polls in order
' for this function to work properly.
'
Sub ibread(device%, data$)
ibrd device%, data$ ' Read data from the GPIB port
If (ibsta And RQS) Then ServiceRequest device% ' Handle any request for service
End Sub

92

© ETS-Lindgren– April, 2006

Revision G– P# 399199