
7-6
Section
Details of BASIC Commands
179
For more information on writing interrupts in BASIC, refer to the
ON COM
and
ON PC
examples in
5.5 Interrupt Functions.
Note:
1.
The port must be opened for input.
2.
Set the baud rate in the communications parameters as follows:
Port #1 + port #2
38.4 bps
Examples:
> 10 ON COM 2 GOSUB 1000
> 20 COM ON
> 30 GOTO 30
> 1000 PRINT “COMMUNICATIONS INTERRUPT OCCURRED”
> 1010 A$ = INPUT$(LOC(2), #2)
> 1020 PRINT A$; “ RECEIVED”
> 1030 RETURN
See also:
COM
(
ON
|
OFF
|
STOP
)
on error
Syntax:
ON ERROR GOTO
( <line number> | <
LABEL
> )
Description:
Statement. Defines an interrupt subroutine to handle error processing.
Remarks:
<line number> is any valid line number in the range : [0…65535]. It specifies the first line in the
error processing interrupt service routine.
ON ERROR GOTO
0 disables the error processing routine.
<label> is a BASIC program label. It references a line number somewhere in the BASIC program.
When an error occurs the error code is assigned to the system variable
ERR
and the line number
containing the source of the error is stored in the system variable
ERL
.
The
ON ERROR
command cannot be used to branch to an interrupt subroutine for errors with error
codes 80 to 99.
Errors that occur during error processing cannot be handled by the BASIC error processing
routine - they will be handled as normal by the system error handler. This will display an error
message to the terminal and execution will terminate.
For more information on writing interrupts in BASIC refer to the
ON COM
and
ON PC
examples in
5.5 Interrupt Functions. While a command is being executed, the interrupt waits.
Examples:
> 10 ON ERROR GOTO 1000
> 20 ERROR 2
> 30 END
> 1000 PRINT “A SYNTAX ERROR HAS OCCURRED IN LINE “;ERL
> 1010 END
> RUN
A SYNTAX ERROR HAS OCCURRED IN LINE 20
See also:
ERC
,
ERL
,
ERR
,
ERROR
,
RESUME
Summary of Contents for C200H-ASC11
Page 1: ...C200H ASC11 ASC21 ASC31 ASCII Units Operation Manual Revised June 2000...
Page 2: ...iv...
Page 4: ...vi...