Etting, Tarted with the, Gpib – ETS-Lindgren 2090 Controller User Manual
Page 76: Code sample 1
Using the GPIB Command Set with the Model 2090
Model 2090 Multi-Device Controller
CODE SAMPLE 1
The following code segment gives a brief example of the
scan function implemented using Visual Basic. It will set
the limits of both a tower and turntable, set them both for
infinite scan count, initiate scan mode on both devices, and
monitor the current position for ten seconds.
ibdev 0, 8, 0, T10s, 1, &HC0A, Tower% ' Initialize GPIB interface
ibdev 0, 9, 0, T10s, 1, &HC0A, Table%
ibwrt Tower%, "LL 100" ' Set lower limit to 100 cm
ibwrt Tower%, "UL 400" ' Set upper limit to 400 cm
ibwrt Tower%, "CY 000" ' Set infinite scan count
ibwrt Table%, "CL 0" ' Set CCW limit to 0 degrees
ibwrt Table%, "WL 359" ' Set CW limit to 359 degrees
ibwrt Table%, "CY 000" ' Set infinite scan count
ibwrt Tower%, "SC" ' Scan tower
ibwrt Table%, "SC" ' Scan turntable
For Counter = 0 To 100 ' Read position 100 times
ibwrt Tower%, "CP?" ' Query tower current position
Read$ = Space$(20) ' Initialize buffer to 20 bytes
ibrd Tower%, Read$ ' Read response
TowerEdit.Text = Val(Read$) ' Display number in edit box
ibwrt Table%, "CP?" ' Query turntable current position
Read$ = Space$(20) ' Initialize buffer to 20 bytes
ibrd Table%, Read$ ' Read response
TableEdit.Text = Val(Read$) ' Display number in edit box
StartTime = Timer ' Read current timer count
While (Timer < StartTime + 0.1) ' Delay 0.1 second
DoEvents ' Let Windows do other things
Wend
Next ' Loop for about 10 seconds
ibwrt Tower%, "ST" ' Stop tower
ibwrt Table%, "ST" ' Stop turntable
ibonl Tower%, 0 ' Free tower's GPIB port
ibonl Table%, 0 ' Free turntable's GPIB port
Note the 0.1 second delay between readings of the devices.
The Model 2090 updates the available position information
ten times per second, so GPIB queries faster than this rate
will return the same information and are simply a waste of
processor time. Since the Model 2090 is capable of
seeking a target position without intervention of a
76
© ETS-Lindgren– April, 2006
Revision G– P# 399199