User Tools

Site Tools



On Recv

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
  Loop   ' Infinite Loop
  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.

Go CUBLOC home

cubloc/on_recv/index.txt · Last modified: 2016/04/14 11:07 (external edit)