newRPL provides full USB support between calculator and PC: the calculator acts as an HID device, therefore the procedure of first-time setup is minimal, practically non-existent is some cases. The language implements a number of commands to handle file transfer between calculator and PC, as well as firmware update, as easy as possible.

Connection

  • Start newRPL Desktop and plug in the calculator to the PC;
  • from the Hardware menu choose USB Connections…
  • under the menu will appear a status bar with a button labeled [ Select a USB device ];
  • after clicking it, a list of devices connected to the PC will be shown: selecting the calculator and clicking Ok will complete the connection;
  • if everything went ok, the status bar will change accordingly;

In case of disconnection the status bar will show [ Click to reconnect ] allowing a quick reconnection of the calculator.

On the models that support USB power, the battery indicator will turn gray when the USB cable is plugged, to indicate it's drawing power from the USB port.

Data Transfer

Once the communication channel is set up, to transfer an object to newRPL Desktop use the command USBSEND: if the transfer is successful, the object will appear on newRPL Desktop screen.

Since USBSEND returns 1 in case of success and 0 otherwise, this snippet of code is the preferred way to ensure that the object on level 1 is transferred.

« DO
    DUP
  UNTIL
    USBSEND
  END
  DROP
»

The receiving calculator will immediately XEQ'te the object after the transfer has completed provided no other program is currently in execution. In that case XEQ'tion will be postponed after the first program has terminated.

The following program puts the above concepts together into action.

« @@ Write a program that sends PONG back to us...
  « "PING"
    "PONG"
    DO
      DUP 
    UNTIL
      USBSEND
    END
    DROP 
  »
  
  @@ ...and send the program to the other side
  DO
    DUP 
  UNTIL
    USBSEND
  END
  DROP 
»

The command USBRECV is used to manually receive an object (avoiding to run it if it's a program): it accepts a time-out in seconds, after which the transfer is aborted. Alternatively, setting flag -47 will achieve the same effect. In any case, if there's data waiting to be received a RX indicator will be displayed in the status area; since transfer are not queued if there's an object waiting to be received, any other USBSEND command issued by the source calculator will fail.

When flag -47 is set an object can be received and automatically XEQ'ted using the USBAUTORCV command.

Backup and Restore

newRPL allows archiving and restoring of memory across the USB wire. Simply:

  1. run USBRESTORE on the receiving calculator: the command needs a time-out in seconds, so
    30 USBRESTORE

    will usually suffice;

  2. run USBARCHIVE on the source machine.

The backup format is totally compatible with SDARCHIVE/SDRESTORE but bear in mind that different platforms support different amounts of RAM: it's always possible to transfer backups across different platforms, provided they fit in the available RAM.

Platform RAM
HP39GS / HP39g+ 256 KiB
HP40GS 256 KiB
HP50g 512 KiB
newRPL Desktop 1 MiB

Firmware Update

FIXME


USB Operations

Command Purpose Example
USBSEND Send an object across USB wire « “CONNECTED!” » USBSEND
USBRECV Manually receive an object across USB wire 5 USBRECV
USBAUTORCV Manually receive an object across USB wire and XEQ'te it USBAUTORCV
USBARCHIVE Send a complete backup across USB wire USBARCHIVE
USBRESTORE Receive a backup across USB wire and restore it 30 USBRESTORE
USBSTATUS Display status of USB connection USBSTATUS
USBON Enable the USB driver USBON
USBOFF Disable the USB driver USBOFF
  • manual/chapter4/usb.txt
  • Last modified: 2019/11/03 06:35
  • by jojo1973