User Tools

Site Tools

한국어

cubloc:on_recv:index

On Recv

On Recv0 GoSub label - Branch to label when data received on COM0
On Recv1 GoSub label - Branch to label when data received on COM1
On Recv2 GoSub label - Branch to label when data received on COM2
On Recv3 GoSub label - Branch to label when data received on COM3

When data is received on one of Cubloc's RS-232 channels, this command will cause the program to 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 GoSub 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

IMPORTANT

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: 2018/03/14 09:36 by COMFILE Technology