Operating and Maintenance Instructions – 27
OPEN "GPIB0" FOR INPUT AS #2
PRINT #1, "ABORT"
PRINT #1, "OUTPUT 05;WVL?"
PRINT #1, "ENTER 05"
INPUT #2, x
PRINT x
END
Serial Polling the Status Register
This sample changes the wavelength setting and reads the status register continuously until
the output has settled.
OPEN "GPIB0" FOR OUTPUT AS #1
OPEN "GPIB0" FOR INPUT AS #2
PRINT #1, "ABORT"
PRINT #1, "OUTPUT 05;csb"
' clearing the status byte clears the settling
bit
PRINT #1, "OUTPUT 05;WVL 1530e-9m"
' change the wavelength to 1530 nm
sr = 0
' initialize sr variable to enter the while loop
WHILE (sr AND 4 )
' loop until settled bit is true
PRINT #1, "SPOLL 05"
' serial poll the TB9 filter
INPUT #2, sr
WEND
PRINT sr
' print final value of sr
END
Generating a Service Request Interrupt
This example tests the service request interrupt function. It unmasks the settling bit in the SRQ
mask register and sends a new wavelength setting. An interrupt is generated when the TB9
grating filter has completed changing the wavelength.
OPEN "GPIB0" FOR OUTPUT AS #1
OPEN "GPIB0" FOR INPUT AS #2
PRINT #1, "ABORT"
ON PEN GOSUB SPOLL
' enable SRQ interrupt
PEN ON
PRINT #1, "OUTPUT 05;CSB;SRE 4"
' clear status register and unmask
' settled bit in SRQ mask register
PRINT #1 "OUTPUT 05;WVL 1552.02nm" ' change wavelength setting
'
' mode executed while wavelength set
'
'
WHILE (INKEY$ = "")
' endless loop to simulate bigger program
WEND
' ends when any key is pressed
PEN OFF
END
SPOLL:
PRINT #1, "SPOLL 05"
' serial poll the TB9 filter
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com