On Recv0 GoSub label
On Recv1 GoSub label
On Recv2 GoSub label
On Recv3 GoSub label
When data is received on one of Cubloc's RS-232 channels, this command will jump to the specified label (Recv0 for channel 0, Recv1 for channel 1, etc…). The processor will automatically check for received data and trigger interrupts when this command is used.
Dim A(5) As Byte OpenCom 1,19200,0, 100, 50 On Recv1 DATARECV_RTN ' Jump to DATARECV_RTN when RS232 channel 1 receives any data Do Loop ' Infinite Loop DATARECV_RTN: If BLen(1,0) > 4 Then A(0) = Get(1,1) ' Read 1 Byte. A(1) = Get(1,1) ' Read 1 Byte. A(2) = Get(1,1) ' Read 1 Byte. A(3) = Get(1,1) ' Read 1 Byte. A(4) = Get(1,1) ' Read 1 Byte. End If Return ' End of interrupt routine
When a Recv interrupt service routine (ISR) is being executed, subsequent Recv interrupts will not be received. After the ISR is finished executing, if there is still data being received, another Recv interrupt will be generated, and the ISR will execute again.