Programming Example: An Mps-8033 Driver - ILX Lightwave MPS-8033 Series User Manual

Precision fiber optic sources
Table of Contents

Advertisement

Programming Example: An MPS-8033 Driver

10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
170
180
190
200
210
220
230
240
250
260
270
280
290
300:
310
320
7/01
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com
SUB
Mps8033dvr(Device_id,Command$,Response$,Err$)
' A subroutine to drive the ILX Lightwave MPS−8033
Fiber Optic Source. This driver
' provides bus timeout protection and looks for device
dependent errors.
ON ERROR GOTO handler
CALL Ibtmo(Device_id, 10)
Cmd_len% = LEN(Command$)
IF (Cmd_len% > 0) THEN
CALL Ibwrt(Device_id,Command$)
END IF
IF (INSTR(Command$,"?") THEN
CALL Ibrd(Device_id,Response$)
END
CALL Ibwrt(Device_id,"*STB?")
CALL Ibrd(Device_id,Status_byte%)
Err_bit% = Status_byte% AND 128
IF (Err_bit% > 0) THEN
CALL Ibwrt(Device_id,"ERR?")
CALL Ibrd(Device_id,Err$)
PRINT "ERROR IN 8033 COMMUNICATIONS
DEVICE DEPENDENT ERROR"
PRINT "ERRORS ARE: " Err?
END IF
IF (Ibsta AND Timo) THEN PRINT "8033 GPIB
TIMEOUT"
EXIT SUB
Handler
PRINT "MISC SOFTWARE GENERATED ERRORS
IN 8033 DRIVER SUB"
END SUB
C O M M A N D R E F E R E N C E
Programming Examples
' Watch for software errors
' Provide 300 mSec timeout on GPIB
' Get length of command string
' Send the command
' Is the command a query?
' Get the response
' Get the Status Byte
' Is the error queue active bit set?
' Get the Error queue
' Report the Errors
' Did the bus timeout?
' Did the software bomb?
4
C H A P T E R
73
MPS-8033
!

Advertisement

Table of Contents
loading

Table of Contents