06.08.2014 Views

(8.5x11) 6000 Manual Cover - Newport Corporation

(8.5x11) 6000 Manual Cover - Newport Corporation

(8.5x11) 6000 Manual Cover - Newport Corporation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CASE ELSE<br />

GOSUB Write.IEEE.String<br />

IF INSTR(IEEEout$, “?”) 0<br />

GOSUB Read.IEEE.String<br />

END IF<br />

END SELECT<br />

LOOP WHILE 1 = 1<br />

RETURN<br />

‘Write user input to IEEE port<br />

THEN ‘If command was a query<br />

‘ Read input data on IEEE port<br />

‘Write.IEEE.String: Write the string IEEEout$ out to the IEEE port.<br />

Write.IEEE.String:<br />

IEEEout$ = IEEEout$ + CHR$(10)<br />

‘Append a to IEEEout$<br />

CALL IBWRT(device.number%, IEEEout$) ‘Write IEEEout$ to IEEE-488 port<br />

RETURN<br />

‘Read.IEEE.String: Read a string from the 2832-C IEEE port. The string<br />

‘ read from the IEEE-488 port is printed on the screen. If the MAV bit<br />

‘ in the status byte doesn’t go high after 8 seconds then this routine<br />

‘ will timeout. Otherwise the query response is in IEEEin$<br />

Read.IEEE.String:<br />

timeout.error% = 0<br />

‘Initiate to no timeout error<br />

poll% = 0<br />

IEEEin$ = SPACE$(255)<br />

‘Initiate IEEEin$ to 255 spaces<br />

ON TIMER(8) GOSUB timeout<br />

‘wait for MAV bit in the status byte to be set or a timeout to occur<br />

TIMER ON<br />

WHILE ((poll% AND &H10) = 0) AND (timeout.error% = 0)<br />

CALL IBRSP(device.number%, poll%)<br />

WEND<br />

TIMER OFF<br />

IF (timeout.error% = 1) THEN<br />

PRINT “IEEE-488 port timed out when trying to read input.”<br />

ELSE<br />

CALL IBRD(device.number%, IEEEin$) ‘Read IEEE-488 port<br />

IEEEin$ = RTRIM$(IEEEin$)<br />

‘Trim trailing spaces<br />

END IF<br />

RETURN<br />

PRINT IEEEin$;<br />

‘Print the query response<br />

‘timeout: Set timeout.error% flag. This routine is called if t seconds,<br />

‘as defined by the ON TIMER(t) function call, has elapsed between TIMER ON<br />

‘and TIMER OFF.<br />

timeout:<br />

timeout.error% = 1<br />

RETURN<br />

END ‘End of Program Listing<br />

100

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!