ON COM¶
Function¶
ON COM defines a routine to be executed when data is received into the communications buffer.
Syntax¶
ON COM GOSUB line number
Example¶
10 ON COM GOSUB 100
20 COM ON
100 'SUBROUTINE TO READ
110 'INCOMING DATA
190 RETURN
Remarks¶
This statement is used in conjunction with the COM statement. It tells Basic where to jump to in the event of a communications interrupt.
Data may be left in the communications buffer for as long as is necessary.
On an interrupt an automatic COM STOP
is executed so interrupts are
never nested. The RETURN from the trap routine performs
an automatic COM ON
, so re-activating the interrupt routine, unless
a COM OFF
statement was executed before the RETURN.