HP 48 tutorial - programming
CUSTOMISING THE HP48
USING CUSTOM MENUS
A custom menu contains programs and functions which are commonly used. The custom menu is displayed simply by pressing the [CST] key.
To create a custom menu
type in a list { label1 label2 ……. } onto the stack.
Press ’CST’ [STO]
CUSTOMISING THE KEYBOARD
As with the HP41 the functions and commands (and programs) can be assigned to a specified key (The USER keyboard).
HOW TO ASSIGN A USER KEY
Type in a list { name #*.0 } and type STOKEYS
where name is the function or program to be assigned
# is the keyboard row of the key to assign
\* is the keyboard column of the key.
TO ACTIVATE THE USER KEYBOARD
Press [L-S] [a] (USER) once for a single use, repeat again to lock the USER keyboard on.
or type -62 SF to do this (in a program).
The USER keyboard can be locked on by typing [L-S] [a] (USER) once if Flag -61 is set.
INTERFACING WITH EXTERNAL DEVICES
The HP48 has a distinctive advantage over many other calculators with its connectivity to printers, PCs, total stations and other calculators. Connectivity can be via Infra-red (IR) or via a serial cable. The IR can transmit across a small-size room, however can only received at a range of about 6 inches ( a US college stipulation ). In order for external communications to be successful the input/output parameters between the HP48 and the external device must be the same.
SETTING INPUT/OUTPUT PARAMETERS
Press [L-S] [1] (I/O) |IOPAR|
This displays the current input-output parameters which must be concordant with the other device.
The IR / WIRE (Serial cable) setting can be toggled by pressing the |IR| key
The default baud rate is 9600. To change the baud rate type the baud
rate onto the stack and press the |BAUD| key.
To upload a program that will be editable on a PC. Toggle the |ASCII|
key so that the ASCII is selected. Press 3 then |TRAN| so that
translate: 3 is displayed.
PRINTING TO AN INFRA-RED PRINTER
By pressing [L-S] [1] |PRINT| several print options are available. To print the contents a variable (or program ) type the name of the variable onto the stack between ’ ’ characters. Press |PRVAR|.
To print the LCD display press |PRLCD|.
To print level one of the stack press |PR1|.
To print the contents of the stack press |PRST|
These commands can also be included in a program, so that results can
be printed during program execution.
If the Printer is printing unusual characters check the print parameters |PRTPA|. Either the delay is to quick (the HP48 is sending data faster than the printer can receive) the default is 1.8, or the printer may be an older model in which case press the |OLDPR| key to re-map the character set.
CREATING A PROGRAM ON A PC
Creating a program on a PC is much quicker than on the calculator itself, due to the inherent benefits of the QWERTY keyboard and editor functions (and speed).
There are a few differences between the appearance of a program on a PC and on the HP48. Mainly due to a different character set on the keyboard. All characters on the PC keyboard are interpreted as is in the HP48 without translation. Where a character on the HP48 is non-existent on the PC keyboard the HP48 translate code has to be used. The back-slash \ character on a PC created program is interpreted by the HP48 that the characters following the \ symbol are to be translated.
For example; to type the command HMS\-> on a text editor type HMS\->
LISTING OF USEFUL TRANSLATE CHARACTERS.
Greek symbols Programming & maths. symbols
HP48 description PC HP48 description PC
S (SIGMA) \GS « Program start \«
W (OMEGA) \GO » Program end \»
D (DELTA) \GD® to \- >
a (alpha) \Ga¬ back \ < -
b (beta) \Gb ’ \34
g (gamma) \Gg <) Angle symbol \<)
d (delta) \Gd ° degree symbol \^o
e (epsilon) \GeÖ (Square root) \v/
h (eta) \Gn£ Less than = \<=
q (theta) \Gh³ Grtr. than = \>=
l (lambda) \Gl¹ \=/
m (mu) \Gm± \177
p (pi) \pi x bar mean \x-
r (rho) \Gr2 2 superscript \178
s (sigma) \Gs3 3 superscript \179
t (tau) \Gt½ \189
f (phi) \O/¼ \188
w (omega) \Gw’ \127
All PC created HP48 programs must have a header (the first line of a PC program), so that the HP can
interpret the program to compile it during the upload.
The most commonly used header is thus:
HP: T(3)A(D)F(.);
Comments can be included in a PC program. Any comments after the @ symbol will not be interpreted on uploading ( or between two @ symbols ).
USING KERMIT TO TRANSFER PROGRAMS BETWEEN PC/HP48
Kermit (kermit.exe) is a public domain interface program on the PC allowing uploading and
downloading of programs and data from the PC to such beasts as the HP48.
HOW TO UPLOAD FILES ONTO YOUR HP48
The HP48 program you wish to download should be in the same PC directory as KERMIT.EXE
(otherwise the current working directory in kermit CWD will have to be changed). The PC should be in DOS mode for kermit to work properly.
A Serial Interface cable must be connected to one of the serial ports at the rear of the PC.
COM1 is usually a male 9 pin com port ( the mouse port )
COM2 is usually the male 25 pin com port ( if you have an adapter )
The other end of the cable connects to a plug at the top end of the HP48 ( a 4-pin port ).
CONFIGURING THE KERMIT
-
in DOS mode type kermit at the DOS prompt
-
type set po 2 (if using com 2 (25 pin)) at the ms-kermit prompt
(otherwise the kermit defaults to com1)
- type set ba 9 (sets baud rate to 9600 bps) at the ms-kermit prompt
(kermit defaults to the 2400)
- if necessary type cwd drive/directory
(kermit defaults to the drive/directory where kermit is stored)
(the drive or directory where the programs are stored eg: a:
SETTING UP THE HP48 TO RECEIVE
-
Press [L-S] then [1] (I/O)
-
Press the |IOPAR| menu key. The HP48 I/O parameters
will then be displayed.
- If the IR/wire mode is set to IR then press the |IR| menu key so that wire is displayed
If the baud rate displayed is not 9600 then
type in 9600 then the |BAUD| menu key.
-
Get to the HP48 directory where you wish the program to be uploaded to
-
Press the [R-S] key then the [#] key so that Awaiting Server Cmd. is displayed.
6 At the kermit prompt type send program where program
is the name of the program to be uploaded.
DOWNLOADING PROGRAMS TO A PC
Connect the Serial Interface cable.
CONFIGURING THE KERMIT
-
in DOS mode type kermit at the DOS prompt
-
type set po 2 (if using com 2 (25 pin)) at the ms-kermit prompt
(otherwise the kermit defaults to com1)
- type set ba 9 (sets baud rate to 9600 bps) at the ms-kermit prompt
(kermit defaults to the 2400)
- if necessary type cwd drive/directory
(kermit defaults to the drive/directory where kermit is stored)
(the drive or directory where the programs are stored eg: a:
- type server
SETTING UP THE HP48 TO SEND
-
Press [L-S] then [1] (I/O)
-
Press the |IOPAR| menu key. The HP48 I/O parameters
will then be displayed.
- If the IR/wire mode is set to IR then press the |IR| menu key so that wire is displayed
If the baud rate displayed is not 9600 then
type in 9600 then the |BAUD| menu key.
-
The translate code should be 3. If not type 3 and press |TRANSI|
-
The transfer should be in ASCII mode press |ASCII|
-
Put the name of the program to send onto the stack
-
Press [L-S] [ 1 ] (I/O) |SEND|
RAM cards
RAM cards are only useable on the expandable GX models and act as ‘detachable hard drives’ so to speak. The GX has two card slots. Card slot one is for 32kB or 128kB cards. Card slot 2 can accommodate up to 2MB Cards. These cards are NOT CHEAP! Backing up important programs and data onto RAM cards is recommended especially if programs are being used where a PC is not accessible. RAM cards can be merged with the main memory of the GX or can remain ‘free’ as partitioned memory. If the card is being used as a backup storage card, it should not be left in the GX in case of memory loss.
WARNING: The HP48 must be turned OFF while a RAM card is plugged in or removed.
MEMORY PORTS
Memory ports are analogous to disk drives on a PC
The main port memory of the HP48 is 0 or :0:
A RAM card in slot 1 is port 1 or :1:
HOW TO SAVE AN OBJECT IN MAIN MEMORY TO A RAM CARD (in port 1)
Ensure the RAM card is plugged in
Recall the object to the stack.
Type :1: NAME [ENTER] where NAME is the destination name
Press [STO]
LIBRARIES
An HP48 library is an object which extends the built in command set, and is generally the format in which most HP48 software and programs are sold. Libraries are not editable or viewable.
A library can’t be used in the same way as a ’normal’ user program. Firstly, a library file must be ATTACHED to the port memory of the HP48, and the calculator turned off and on again after attachment before the library can be used. Libraries are either attached to the main memory of the HP48 ( Port :0: ) or usually the RAM card in port 1 (Port :1:)
HOW TO ATTACH AND USE A LIBRARY
Upload the library file to the HP48 using kermit
Press [VAR] to display the library variable
Press the |Library| menu key to Recall the library to the stack
Type : 0 : Library name [ENTER] [STO] to store the program in memory (port memory)
Type : 0 : Library name [ENTER] [L-S][2](LIBRARY)[NXT]|ATTAC| to attach the library
Delete the library file ( the downloaded file ) to save memory
Turn the HP48 off, then on again.
To access the library commands and functions press [R-S] [2] |library| to display the menu of
library functions.
HOW TO PURGE A LIBRARY
Type : 0 : Library name [ENTER] [L-S][2](LIBRARY) |DETAC| To detach the library
Type : 0 : Library name [ENTER] [L-S] [EEX] (PURGE) To purge the library