USBRECV


Synopsis


Receive an object through USB link

Stack Diagram


Input Stack Output Stack
Numtime-out O 1
Numtime-out 0
Level 1 Level 2 Level 1

Legend

Type Command
Parallel list processing Group 5
Affected by flags -47 Automatic reception and execution of data sent via USB

Description


The USBRECV command receives an object transmitted by another calculator using the USB link, provided the connection has been successufully negotiated. Since by default object reception happens automatically without an explicit use of USBRECV, the pre-condition for usage of USBRECV is the disabling of automatic reception by setting flag -47.

If the transfer succeeds USBRECV will leave the object 1 on the stack, otherwise it will leave only 0. The incoming object will NOT be XEQted - see USBAUTORCV if this feature is not desired.

The USBRECV command accepts a time-out parameter expressed in seconds. After the time-out elapses USBRECV aborts with a failure. Also, transmission can be interrupted pressing ON before time-out ends.

To signal the user of an incoming object waiting to be received an RX indicator is displayed in the status area.

Compatibility


This command is new in newRPL and does not exist in userRPL.

Usage


The following program

« @@ Send the variable name to the other side
  DO
    DUP 
  UNTIL
    USBSEND
  END
  DROP

 @@ Now create a program to RCL and send back the result...
  «
    RCL 
    DO
      DUP 
    UNTIL
      USBSEND
    END
    DROP 
  »

  @@ ...and send the program to be auto-executed over there
  DO
    DUP 
  UNTIL
    USBSEND
  END
  DROP

  @@ Wait a couple of seconds for the contents to arrive
  IF
    -47 FS?
  THEN
    2 USBRECV
    DROP
  END
»

executes a RCL through USB. See USBSEND for implementation of a USB STO.

Related Commands


USB Communications 8 NEW

Command Short Description
USBSTATUS Get status of the USB driver NEW
USBRECV Receive an object through USB link NEW
USBSEND Send an object through the USB link NEW
USBOFF Disable USB port NEW
USBON Enable USB port NEW
USBAUTORCV Receive an object and execute it NEW
USBARCHIVE Create a backup on a remote machine NEW
USBRESTORE Restore a backup from a remote machine NEW
  • manual/chapter6/usb/cmd_usbrecv.txt
  • Last modified: 2019/11/17 14:19
  • by jojo1973