This is an old revision of the document!
USB connectivity
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.
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 trasfer has completed provided no other program is currently in execution. In that case XEQ'tion will be post-poned 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.
Backup and Restore
newRPL allows archiving and restoring of memory across the USB wire. Simply:
- run
USBRESTOREcommand on the receiving calculator: the command needs a time-out in seconds, so30 USBRESTOREwill usually suffice; - run
USBARCHIVEon 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 |
|---|---|
| HP39 | 128 KiB |
| HP40 | 128 KiB |
| HP50g | 256 KiB |
| newRPL Desktop | 1 MiB |