NOTES:
If the BIT=0, then no error has been detected. The RS-232 status register can be read from BASIC using the variable ST. If ST is read by BASIC or by using the KERNAL READST routine the RS-232 status word is cleared when you exit. If multiple uses of the STATUS word are necessary the ST should be assigned to another variable. For example: SR=ST: REM ASSIGNS ST TO SR The RS-232 status is read (and cleared) only when the RS-232 channel was the last external I/O used. |
10 REM THIS PROGRAM SENDS AND RECEIVES DATA TO/FROM A SILENT 700 11 REM TERMINAL MODIFIED FOR PET ASCII 20 REM TI SILENT 700 SET-UP: 300 BAUD, 7-BIT ASCII, MARK PARITY, 21 REM FULL DUPLEX 30 REM SAME SET-UP AT COMPUTER USING 3-LINE INTERFACE 100 OPEN 2,2,3,CHR$(6+32)+CHR$(32+128):REM OPEN THE CHANNEL 110 GET#2,A$:REM TURN ON THE RECEIVER CHANNEL (TOSS A NULL) 200 REM MAIN LOOP 210 GET B$:REM GET FROM COMPUTER KEYBOARD 220 IF B$<>"" THEN PRINT#2,B$;:REM IF A KEY PRESSED, SEND TO TERMINAL 230 GET#2,C$:REM GET A KEY FROM THE TERMINAL 240 PRINT B$;C$;:REM PRINT ALL INPUTS TO COMPUTER SCREEN 250 SR=ST: IF SR=0 OR SR=8 THEN 200: REM CHECK STATUS, IF GOOD THEN CONTINUE 300 REM ERROR REPORTING 310 PRINT "ERROR: "; 320 IF SR AND 1 THEN PRINT "PARITY" 330 IF SR AND 2 THEN PRINT "FRAME" 340 IF SR AND 4 THEN PRINT "RECEIVER BUFFER FULL" 350 IF SR AND 128 THEN PRINT "BREAK" 360 IF (PEEK(673) AND 1) THEN 360:REM WAIT UNTIL ALL CHARS TRANSMITTED 370 CLOSE 2: END
This page has been created by Sami Rautiainen. | |
Read the small print. | Last updated May 25, 1998. |