HP Forums

Full Version: WP 34S - Getting connected...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

WP 34 Serial I/O

I've added some serial I/O stuff to the most recent WP 34S builds for Windows and the hardware. You will need the cable provided by HP or a modified 20b or 30b to make use of this. The original cable draws power from the batteries and should be disconnected while not in use.

Communication is between a 34S and another 34S. The Windows emulator counts as a valid partner so you can exchange data between your calculator and the PC. Since PCs tend to have more than one port it is necessary to tell the emulator which one to use. Create a file "wp34s.ini" in the directory where the state files reside and put the name of the port as the only line in this file. Mine says "COM9:" without the quotes. This is the very same port that SAM-BA uses to access the calculator for flashing.

Sending programs, registers or all RAM

The commands mentioned here are found in the X.FCN catalog.

The commands to send and receive have a fixed timeout of some 10 seconds for setting up the connection. After a period of inactivity "I/O Error" is shown which indicates that no communication has occurred. The timeout value is fixed and cannot be changed. If I/O Error appears in the middle of a transmission you should try again. The little "=" sign is lit while the serial port is in use. The ON/EXIT key can be used to abort a communication.

Start the command RECV on the receiving device. It will display "Wait...".

On the sender you have three choices:

SENDP will send the user program space. If all went well, the receiver will display "Program".

SENDR will send the registers 00 to 99. If all went well, the receiver will display "Register".

SENDA will send the complete 2 KB of non volatile memory. If all went well, the receiver will display "All RAM".

User program access to the serial port

We have removed this functionality for the time being.

The P.FCN catalog has commands to access the serial port to send and receive individual bytes or short strings.

SOPEN will open the port with either default parameters of 9600 baud, 8 bits, no parity and 1 stop bit, or with the settings taken from the alpha register. The default settings (empty alpha) look like this:


The port used on the hardware does not support values <> 8 for the bits parameter. The number of stop bits is always set to 1. Parity may be E, O or N. The baud rate divisor is calculated from the baud rate value. Without a crystal this is not very accurate but I did not have problems with my development 20b here. You can omit parameters which have the default value. I/O Error is returned if the parameters are invalid or the port cannot be accessed (Windows).

SCLOSE disables the serial port.

The little "=" is on while the port is active. Power saving is very much disabled because the timing of the serial port depends on the clock speed. So its advisable to turn the port off with SCLOSE after the transfers are done.

SEND1 takes an integer value from X and sends the low order byte to the port.

RECV1 takes a timeout value in 0.1 second units from X and returns a byte received via the serial port. The value is -1 for timeout, -2 for transmission errors or -3 for manual abort with the ON/EXIT key.

[alpha]SEND sends the contents of the alpha register with a CR as the delimiter.

[alpha]RECV takes a timeout value from X just like RECV1 and reads data into the alpha register. A CR ands the transmission normally but timeouts or errors stop the transmission, too. You can only check the length of alpha after the transfer, no error code is returned. We may change this to return a code in X but this isn't implemented yet.

A command to send the X register might be useful as would be options to change the delimiter (CR) for string transfers.

Edited: 26 July 2011, 3:10 a.m.