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.

5010 ‘Characters are read one at a time until a character is<br />

5020 ‘read or 8 seconds elapse between consecutive character reads.<br />

5030 ‘At the end of the routine the string read is in RS232IN$.<br />

5040 BUFFER$ = CHR$(0) ‘Initialize buffer$ to NULL character<br />

5050 RS232IN$ = “”<br />

5060 TIMEOUT.ERROR% = 0 ‘Initiate to no timeout error<br />

5070 ON TIMER(8) GOSUB <strong>6000</strong> ‘Set timer for a 1 second time out<br />

5080 TIMER ON ‘Turn on timer<br />

5090 ‘While port doesn’t timeout and string deliminator not<br />

5100 ‘read, continue trying to read input on COM port.<br />

5110 WHILE TIMEOUT.ERROR% = 0 AND BUFFER$ CHR$(10)<br />

5120 IF LOC(1) = 0 THEN GOTO 5170<br />

5130 TIMER OFF<br />

5140 BUFFER$ = INPUT$(1, #1)<br />

5150 RS232IN$ = RS232IN$ + BUFFER$<br />

5160 TIMER ON<br />

5170 ‘<br />

5180 WEND<br />

5190 TIMER OFF<br />

5200 IF TIMEOUT.ERROR% = 0 THEN GOTO 5230<br />

5210 PRINT “Timed out when reading RS-232 port.”<br />

5220 TIMEOUT.ERROR% = 0<br />

5230 ‘<br />

5240 PRINT RS232IN$;<br />

5250 ‘<br />

5260 RETURN<br />

5270 ‘<br />

<strong>6000</strong> ‘timeout: Set TIMEOUT.ERROR% flag. Called if t seconds, as<br />

6010 ‘defined by ON TIMER(t), in the Read.RS232.String, has elapsed<br />

6020 ‘between TIMER ON AND TIMER OFF.<br />

6030 TIMEOUT.ERROR% = 1<br />

6040 RETURN<br />

10000 END ‘End of Program Listing<br />

98

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

Saved successfully!

Ooh no, something went wrong!