Technical information

BASterm Serial Solutions
outputs the translation to the screen. The ON ERROR statement
allows the program to continue running even if an error occurs.
Writing To The File.__________________
Writes to the serial port file are shown below.
Figure 10-3. Output Subroutine.____________________________
10000 ’**************************************************************
10010 ’Send characters in buffer$ out to port.
10020 :
10030 ON ERROR GOTO 10200
10040 :
10050 FOR I = 1 TO LEN(BUFFER$)
10060 :
10070 LSET P$ = MID$(BUFFER$, I, 1)
10080 :
10090 PUT #1
10100 :
10110 NEXT I
10120 :
10130 ON ERROR GOTO 0
10140 :
10150 RETURN
10160 :
10200 ’Output error handler
10210 :
10220 PRINT "Failed to output characters to port."
10230 :
10240 RESUME NEXT
10250 :
10260 :
The variable P$ is set to successive characters of the output
string, and PUT is used to send these to the serial port. The ON
ERROR trap catches any failure to write to the port.
Closing The File._______________
A simple CLOSE statement closes the file.
Figure 10-4. Closing The File.__________________________
15040 CLOSE #1
Chapter 10 Page 157