beautypg.com

Ypical, Low of, Code sample 2 – ETS-Lindgren 2090 Controller User Manual

Page 77

background image

Model 2090 Multi-Device Controller

controlling program, the only reason a program needs to

check the current position is to update a position display for

the user. The user cannot possibly respond to data faster

than ten times a second.

CODE SAMPLE 2

This code segment is significantly more advanced. It uses

the *OPC? command to determine when a device has quit

moving and takes into account possible problems due to

overshoot and undershoot. This program performs a

complete pre-compliance scan, with both horizontal and

vertical polarizations.

Dim TowerDone As Boolean, TableDone As Boolean
Dim Angle As Integer, StartTime As Single
Dim LastPosition As Single, UpperVertLim As Single
Dim Read$

'
' Initialize the tower and turntable
'

ibdev 0, 8, 0, T10s, 1, &HC0A, Tower% ' Initialize GPIB interface
ibdev 0, 9, 0, T10s, 1, &HC0A, Table%

'
' Set 2090 numeric mode and Upper/CW and Lower/CCW limits for both devices
' Note the use of semicolons to combine commands on one line
'
ibwrt Tower%, "N2;LL 100;UL 400" ' Set limits to 100 cm & 400 cm
ibwrt Table%, "N2;CL 0;WL 359" ' Set limits to 0 & 359 degrees
UpperVertLim = 380 ' Set upper vertical limit to 380 cm
' (Used later in program)

'
' Send both devices to their lower limits and wait until complete
'

ibwrt Tower%, "DN" ' Send the tower to the bottom
ibwrt Table%, "CC" ' Send the turntable to zero
TowerDone = False ' Initialize flags
TableDone = False
Read$ = Space$(20) ' Initialize buffer

Do ' Update display while waiting
ibwrt Tower%, "CP?" ' Query tower current position
ibrd Tower%, Read$ ' Read response
TowerEdit.Text = Val(Read$) ' Display number in edit box

©ETS-Lindgren, April 2006

77

Revision G– P#399199