The Radio Card project

Version franšaise

Here are the very new information about the radio card project on HP48GX.

The radio card itself
-  pictures of the original version

Software section

-  InterHP 1.02

-  ChatHP
  x How does it function
  x Version 1.01c radio for HP48GX       x Version 1.01b radio for HP48SX
  x Version 1.01c IR for HP48G(X)         x Version 1.01b IR for HP48S(X)
  x Version 1.01c wire for HP48G(X)      x Version 1.01b wire for HP48S(X)
  x Stand-alone libraries
  x Sources

The card itself

imagined, created, made and developped by
Arthur Patrouchev

Card scheme

It is an electronic circuit of about 10 x 6 x 1 cm. It fits into the site for RAM/ROM cards. The power is supplied by the HP48GX AAA batteries, which doubles the electric consumption but remains reasonnable compaired to other attempts to make a radio module : it is not necessary to change batteries every 5 minutes.

Transfers pass by the serial port, under the RS232C standard. New prototypes (in construction) will allow to discreetly connect the card to the serial port and (hopefully) close the cover again; for the time now, connexion is still visible. To improve the limited transfering range, antennas (thin metallic wires) have been implanted on the circuit. It was preview to put them into the groove of the calculator's case, but that operation decreases efficiency of about 95 %.
Finally, the operational range is of 50 meters, with ability to go through (medium) walls and floors. A Chat has even been experienced from two different stairs (such a nice time) !

The optimal transfer speed (and previewed one) for this card is 1200 bauds. The radio wave frequency chosen is 433 MHz. Of course, this should be no match for the InfraRed, much faster and more reliable.
The major interest of radio transfering is to remotely exchange informations, whatever the HP48GX exact position could be. Furthermore, the curently-developped sofware(cf software section) uses radio waves to create such a virtual network, where each calculator provided with the card and the software has a specific identity of 10 nibbles, corresponding to its serial number.

Here are the most awaited pictures of the radio card.
(first version, without antennas and with huge serial connector)
A big thanks to à Philippe Pamart for having scanned the pictures.

Cost : the current prototypes are about 250 FF, about 40 american dollars.

Fore more information about the card (pictures, all technical schemes) : Arthur Patrouchev's site.

The software

The whole interest of radio wave transfering is to exchange information. However, a presentation at the french epita's Open HP in France made proof that, as usual, the standard RPN HP commands were not enough. Only strings were exchanged, and datas were oftent corrupted, even missing, in particular because both HP48 didn't start sending and receiving at the same time....

From where interest to write a communication soft, specific of the radio card, which could synchronise sendings and correct many errors, via the serial port at a speed of 1200 bauds (which gives 1 byte = 1 character transmitted in 1/150 second) :

InterHP v1.02

Still working on it... This library features a specific installation on YOUR calculator, identifying thus the serial number and so the HP48GX on the virtual network. A new installation exe (3K) is now available, but the protocol synchronization still needs to be improved.

A modified version using InfraRed has now been released, in order to watch the transfer speed and the operationnal transfer system.

Use :

The installation is made typing the HP48GX's serial number, for instance 3422S04545.
The calculator restarts then, and library number 505, InterHP v1.01 is now installed on port 0.

To send, put the obect to be sent on stack level 1. Then, type in the receiver's adress (it's HP48GX's serial number) on level 1, under the form of a string. For instance, put "3422S04545" on stack level 1. Launch the ADR? entry of InterHP, which converts the string into a hexadecimal binary integrer.
Letters from the serial number are to be converted into hexadecimal digits, according a 6-modulo : thus G,M,S become A, and H,N,T become B, and so on. In the example given, the integrer is #3422A04545h. Don't forget to set the hexadecimal mode with HEX.
Press now the key belonging to the entry "Send" of the library and press little time before or after the key belonging to "Recv" on the receiver HP. To interrupt the program, usually press any key except [ON], and [ON]-[C] at the beginning of "Recv" in case of nothing is received.

The protocol used :

- test of the network by the sender : 6,5s or less, the I/O indicator is often swiched on little time before the end, made to prevent from jamming another current sending with an unappropriate transfer.

- Sending the requests by the sender (about ten), duration: 8s. The busy annunciator is lighted on during the transmission.

Requests include the sender's ID, protected by a CRC, and the receiver's one too, the size of the object to be transfered and the number of "packets" ( coded unit of datas including 25 bytes of efficient information ) that the sending will need. (the receiver MUST switch its I/O on, else, it means no request was received. If it is only switched at the end, there are great chances that the requests may not have been properly received)

If the receiver gets a request adressed to another hp, it keeps itself silent, not to jam the transmission.

If the objet to transmit is too large, the receiver sends a radio "IM" message to the sender which displays then an "Insufficient remote memory" error.

- sending the authorization : a single, double, one from the receiver. On the same, the autorization is signed and adressed to ONE hp. This is one of the weak points of the transfer protocol (a failure is possible). Well, if the attempt to receive an authorization fails, the sender sends again 8 seconds of requests.
The inconvenient is that if the receiver has indeed yet given its authorization and that it doesn't receive any object packet, it hasn't the idea (for the time now) to send again its authorization...

- sending the object : the time depends on the size of the object sent. Let's say, 4s for the sample object, 'Obj', included in the directory.

The object is coded in packets written as following :
ID_sender+CRC   "to"   ID_receiver+CRC
length_objet+CRC   number_of_current_packet+CRC
5_bytes+CRC   5_bytes+CRC   5_bytes+CRC   5_bytes+CRC   5_bytes+CRC

The "to" is characteristic of ANY sending on the virtual network. In particular, this allows the sender to detect current transmissions.

The whole object coded in packets is immediatly sent twice. Thus, if an error occured, it can be corrected without asking for a new sending.

- Sending the Ack, acknowledgement from the receiver. ( to be improved : if nothing is received by the sender, neither Ack nor Cor to re-send, the sender SHOULD send again the object, say up 3 times sending then waiting for reply... and then stop. For the time now, it waits forever a confirmation, either positive or negative ).

Or if any part of the object is damaged, the receiver asks for correction :
"Cor" ID_receiver+CRC (twice)
"to" ID_sender+CRC (twice)

- Over : if everything went ok, the receiver displays the transmitted object at stack level 1, and the sender puts <1h> at level 1 (which means transfert successful).

As requested by some programmers, here are the sources of InterHP v1.02 :
Radio version and Infrared version.

Last remark : this is a 100 % assembly langage software, that's an evidence... :-)



As requested by many programmers and users (thanks to Arthur, SunHP, Shadow, Benoît, Philippe and lots of others for their encouragements), I've written a Chat system which presents several advantages :
the message sending function works to many receiving HPs at the same time thank to a message individual resend asking-for protocol and above all because messages sent will be SHORT (less than 130 characters, enough in my opinion, because message-containing packets must be stored in the I/O buffer).

How does it function :

Here again, all HPs will be identified with their serial number, but the display of received messages is made through an ID / usual name table to get understandable names.

The received messages are simply stored on the stack, with above this message stack a string like
"Chat session 18:05 19/05/99"... A Chat session can thus easily be saved.

The messages are coded
"xxxxx>Hello, are you fine ?" with possibly many lines BUT 22 or less characters per line.
(That is of course checked before starting an old chat session).
"xxxxx" is for the way the ID's bytes are displayed.

The ID / usual names conversion is made through a Linked Array object, stored in a Home variable called 'TabCor'
Internal information is stored in another Home global variable called 'ChatPar'.

The display is made using the standard size 2 font.
(And to change the font ? This will come later... :-) )
The first 7 lines of the screen contain the received messages, and the 8th one displays the current line, with a (soon, in version 1.02) flickering cursor...

Chat sample

Notice the "Eden"-like cursor, on the bottom...

I initially thought I could realize a VERY fast routine, less than 1/150 second, to listen to the radio card for a received character between every screen update.... Lost cause, even after having completely reprogrammed the ROM display routine for size 2 font characters , that challenge seems to be illusory... Fortunately, I've just found an easy way to speed the screen update : in fact, most of the time, the last line is the only one which needs a refresh, and furthermore only when a proper key has been hit.
Finally, the principal task is the keyboard and current line management, with often calls to the radio receiving routine and a screen update if necessary.
About the sending, I fear it is necessary, to assume a sufficient reliabily, to perform it as monotask. ( however, giver the size of a single message, this takes less than a second in any case ).

Concerning the current line management routine, notice that ALL characters you can type in with keyboard shortcuts are implemented. The time of key repetition is still quite short, so you may have to type quite fast.
Only difference with the standard keyboard, the new-line character is not allowed in the current line, so I replaced it by ";" and you can get with [Right-Shift]-[.].
If the line typed in contains more than 22 characters, the line analyser will insert new line characters, trying to keep if possible characters of the same word on the same line and to put as many as possible words together on the same line.

About the radio transfers, which mostly consist in exchanging messages although asks for resending a message is also featured in case of an interference would have jammed a transmission, well, the whole thing now appears to be functional.

Use :

The links are to several installation executables. All you have to do is to transfer the exe to your HP48 and then launch it.
Type in the serial number of your calculator ( the succesion of 10 digits and letters engraved on the back of the HP ), then your usual name, and wait for the system to restart. The library is now stored in port 0 - ChatHP, designed to work only with a radio card which excludes any RAM card, is only to be installed in port 0 - and the ID/ usual names table is put in the 'TabCor' Home variable ( you may now erase the installation exe).
Since then, you can launch 'Chat' ( first entry of the Library 503 ) and talk as on the Net between two HPs or more... ;o))

Remark : to chat with more than two HP48, the radio card network is far easier to use. Between only two calculators, the wire and infrared versions are suitable.

Remember that the radio versions of ChatHP contain a test which checks the presence of a functional radio card connected to the serial port. If no reception is possible, a "Radio card malfunction" error occurs.

In theory, you can keep the 'TabCor' variable and remove the Chat HP v1.01c library. If you want then to get the library back on your HP without restarting the installation exe, this means without re-type in your name and HP48GX's serial number, and without erasing the whole contact list stored in 'TabCor', you may manually install the stand-alone libraries.

Editing the contact list ( the ID / usual names correspondance table ) is also finished, with three commands :

- Add Contact : takes a string at level 1 which is a usual name for the binary ID on level 2 ( for instance # 3244A04545h ) it belongs to.
To calculate the binary, read the serial number of your contact's HP48GX, and replace letters other than A - F by A-F hexadecimal digits.
It modifies or creates a Home variable called 'TabCor', which is a Linked Array object.

- Del Contact : takes as an argument a string from stack level 1, which represents a contact's name and erases it from your contact list stored in the HOME variable 'TabCor'.

-List : performs a display of all the contacts you've added with 'Add Contact' in 'TabCor'. The first name in the list is the local HP's owner.
That's the hexadecimal number in front of that name you have to provide to any other Chat user for him to type it on stack level 2, then to type your name as a stack level 1 string, and finally add you to his contact list with the entry 'Add Contact'.

ChatHP v1.01c, radio version for HP48GX :

The third version of Chat HP is now available !

Chat HP v1.01c for HP48GX

The system functions in a pretty satisfying way ; launching a new session or even an old one works prefectly, with a precise analysis of the stack you provide the Chat program with.


The 1.01b version adds, as requested by some users, the command 'Del Contact'.

The 1.01c version performs a better management of the keyboard, and it is now possible to receive perfectly while typing a text.

Version 1.01c IR for HP48G(X) :

This modified version of ChatHP radio version allows you to get a view through ChatHP's abilities without owning two radio cards and two HP48GX.
Two HP48G(X) are recommended, but the program also functions with only one (no transmissions though, of course).
The modifications made concern setting the RS-232 through the infrared diods, removing a receiving test at the beginning of the sending subroutine, and adding a stop character after each sending. (In the radio version, this one comes from the residual radio jamming).
A stop character is needed for the system to detect the end of the transmission, based on the frequency of transmission.

This should so supply a preview to all happy owners of at least one HP48G(X).

Version 1.01c wire for HP48G(X) :

Why another wire version of Chat HP ?
Still because of the lack of stop character in the sending routine of the radio version, needed while transfering by wire where the jamming is null. So, here is to use the HP48G(X) with a HP-HP link : Version 1.01c wire for HP48G(X).

Version 1.01b radio for HP48SX :

This version is written for the HP48SX. It behaves just the same as HP48GX radio version, except the size 2 character font in the ROM of the HP48SX is put under the system RAM... To make it easier to program, I chose to use the Universal Font Library 3, which you'll have to install on the HP48SX before to be able to use the S(X) versions of ChatHP v1.01b.

Version 1.01b IR for HP48S(X) :

Just the same as InfraRed version 1.01b for HP48G(X), but written for the HP48S(X). Here too, you must install the Universal Font Library before you can use Chat HP on your HP48S(X).

Version 1.01b wire for HP48S(X) :

Here is the version you need to chat via a HP-HP link. You've still to install the Universal Font Library before you can use that version of Chat HP on your HP48S(X).

Coming soon :

Version 1.02, with flickering cursor, lightening annunciators and real time battery test, and lots of other things...!

Stand-alone libraries :

The stand-alone libraries are available too, but using the installation executables is absolutely necessary when you first install a version of ChatHP 1.01c on your HP48. Indeed, the installation exe creates from the serial number and the user's name a HOME variable called 'TabCor', needed by ChatHP v1.01c to function properly.

Sources :

The sources are public domain, and as all good programs for the HP, InterHP et ChatHP are perfectly free. Each version has its source, under the form of a directory. Apply the 'D->LIB' entry of library <-LIB-> to create the stand-alone library. Use HP asm 1.1 gx to assemble the machine laguage code's sources ; Use command '->Prg' from EXT48 v2.4 to compile each System RPL program.

Last update :01/23/2001 18:00 GMT+1

Send your congratulations to :

All those programs were made with Eden 2.0, AsmFlash, MLDL 2.0, Ext v2.08, <-LIB-> and EXT48 v2.4.

Back to the main HP48G(X) page