Back Up Next

30.  (38G/39G/40G only) Can I make my own serial cable for use in downloading aplets from a computer?

Question submitted by: Trevor Gillies, Ocean Reef S.H.S. (plus various others)

Answer: The first point that needs to be made is that there is no point in having a cable if you don't have the software (HPGComm) but once you have a cable then you can download the latest version of the software from my Utilities page for free.

I've never done this as HP have supplied me with cables because of the work I've done for them. However, if you want to try making your own cable then you can certainly give it a go if you have the ability.  (I'm not that good at soldering but Trevor says he was successful.)  You can't buy a plug with the right spacing between pins (I've tried at electronic warehouses) but I'm told that the plug that connects a hard drive to the mother board inside your computer uses the right spacing. There must be a lot of those lying around and so you can cut one of them up and cannabilise it.

Alternatively, I saw the following comment on an HP discussion forum:

Just get an old serial mouse, open it up, and use the cable (DON'T CUT
IT OUT). You have to reverse the two inside connections on the 4pin
side ( it needs to be the white connector, not the black one), but
that's easy. After that, reinforce the small 4pin connector with some
heat shrink

I tried this with no success but I have absolutely zero skills when it comes to the hardware side of things so I may simply have mucked it up.

According to the HP discussion forum, the wiring pinouts for the HP49 (which is the same cable as for the HP38/39/40G) are:

           Top of HP39G Calculator

                 Bottom of calculator

Pins 1 to 4 are used for the RS232 communication.  Pins 5 to 10 are used for the HP overhead display connection and so are not required if a homemade cable is only going to be used for communication with a PC.

Pin Signal Pin Signal
1 Shield 6 XSCL
2 TX 7 LP
3 RX 8 LD0
4 SGND 9 LD1
5 VCO 10 GND


31.  Can you use Reverse Polish Notation (RPN) on the calculator?

Question: I like everything about the HP except for the fact that it isn't reverse polish.  Has anyone written an aplet or program to accept reverse polish inputs in the home view?
Submitted by: Edward N Pilbrow, CAD Centre, Canterbury University

Answer: Yes. If you look on my Miscellaneous page you'll find not one but two programs written to simulate RPN. They are, however, only simulations!

32.  How can you graph inequalities on the calculator?

Question: [...] the work we are covering now requires us to calculate inequailities  ie:  y<3x-4    I have absolutely no idea how to do this, but it seems fairly simple on the Casio machines.
Submitted by: Trevor Gillies, Ocean Reef S.H.S.

Answer: Yes, its a pity the calculator does not have this ability built in. I have written an two aplets which might help you.  The first is an aplet which is very similar to the Function aplet except that it has an extra entry on the VIEWS menu of 'Shade'.  The other will solve Linear Programming problems, which is a topic in Year 12 Applicable Maths in West Australia.  You can download either of these aplets from my Aplets page. Go to Maths aplets and then look in the Functions and Calc section, or look in the Misc section.

33.  Why does my calculator freeze when evaluating integrals with an ABS value in them?

Question: I have a problem regarding the calculation of the area trapped between the curve y=abs(f(x)). I have tried using the Calculus function (users guide),but this function causes the HP38G to hang up. I would like to know if the HP38G has a built-in routine for evaluating the integral for absolute functions directly.
Submitted by: James Yates

Answer: If you try to evaluate (for example)  then the 38G will indeed appear to freeze.  Actually if you leave it long enough it will answer the question but 25 minutes (on a 39gs) or 2 to 3 hours (on earlier models) is a little unrealistic for most of us.  If it's already stuck on the calculation, it is possible stop it by pressing the ON button.

According to Jim Donnelly, who was part of the design team for the original 38G model....
"The reason the calculation took so long is that the ABS function creates a discontinuity in the function at X=-2 and X=2.  The area calculation gets really confused by discontinuities, which is why you see similar problems when you try to use functions with ranges (implemented with IFTE) in them on both the HP 38G and the HP 48G/GX.  The extra time you experience is an artifact of the algorithm not being really designed to handle discontinuities."

There are two possible solutions to this problem, one simple and one more involved...

  1. Rewrite the function without the ABS( ) part.  For example, you would rewrite f(x)=x2-4 as 
    If you put  F1(X)=X2 - 4 into the Function aplet then the original integral could easily be done in the HOME view using  the calculation:
    Similar tricks can be used for areas between curves.  It's not ideal but it's not the end of the world either.
  2. This is trick I was only recently told about and it's really neat! Just change into Fixed 4 in the MODES view and you'll find that the calculation can be done in a fraction of the time. Why this works I'm not quite sure, since I was under the impression that the MODES setting only affected how the final result was displayed. But... there you go!

34.  Is it possible to adjust the volume of the BEEP or switch it off?

Question: Is in hp38 any possibility to regulate the level of beeper noise? I would like to make it in a low voice or even turn it off?
Submitted by: Jacek Rosiak (Poland?)

Answer: No, unfortunately there is no built in method to switch it off. The beep is caused by a piezzo electric device and therefore its volume cannot be adjusted either. In later models the volume was lowered because of complaints.

35.  What is the origin of the strange number (6.0030000004) on the cover of the 38G?

I was playing around with one of your aplets and the number 6.0030000004 came up - the number on the cover of HP38 which reminded me that I was meaning to find out what the significance of that number was. I asked my math teacher but he didn't know and its been bugging me for a while now. Do you have any idea what the number is?
Submitted by: Tania Jacob

Answer:   I suggested to Tania that the number might be one from Physics (I think I was remembering Avagadro's Number which is actually 6.0221367x1023) and said that she should talk to her science teacher (it's called passing the buck!).  She replied that she had written to HP and been told.....

That's what happens when you let a graphics designer pick a number. It doesn't actually make sense but looked good to the person who choose it. I've heard stories which ranged from "it was 3+3 when added on prototypes" to "it's such and such made up constant". The truth is far more boring.  It made production because a lot of people thought it would be interesting to see what people would come up with for it.

Many thanks to Tania - a fascinating result & not at all what I expected!

36.  I've stored some Notes onto my computer and now I can't read them back.

Answer: At our school we set up the connectivity software and the ADK (see my Utilities page) on our mathematics dept computers so that our students could store their Notes onto them.  This is very important for two reasons.  Firstly, if the calculator gives trouble and has to be reset then they will lose their Notes if they have not been saved regularly.  Secondly, if I catch a student playing a game on their calculator in class then I do a full reset and wipe their memory (yes! I do warn them!). Thirdly, just as Windows will become unstable if you keep suspending for weeks instead of shutting down, the HP will eventually (>12 months) become unstable if you don't reset it. I recommend that people do a full reset every six months, saving their work to the PC first.

The problem is that some of the students are reporting that Notes which they saved are now unreadable when they try to retrieve them from the PC. This generally does not happen unless you have done something to interfere with the files.

My suspicion is that the problem is usually caused by people editing the Notes in a word processor.  This is NOT a good idea.  Most word processors add extra information to a file regarding paragraphing and formatting and this usually damages the file, making it unreadable by the Connectivity Kit.

This is probably not deliberate.  The Connectivity Kit usually stores the Notes as files with an extension of .000  and if you double click on one of these files then Windows won't know what to do with it.  It will probably pop up a dialog box asking you which program you want to use to edit the file and if you click on OK instead of Cancel then, no matter what you choose, it will probably be wrong and cause damage to the file.  The only program which you might get away with using is Notepad, but I have even known that one to cause difficulties because of the special characters which the calculator uses such as the STO character. If you want to edit a file on the PC then the best idea is to use the aplet Development Kit (more on this later).

The other way that you might damage the files is to double click on them in the Connectivity Kit window instead of clicking on the 'Connect' button.  If you do this then older versions of the Connectivity Kit tried to let you edit the files in a word processor and, as we've already discussed, this is not a good idea.

So..... how do you fix things if you have some damaged files?   The process is not all that simple and I would not advise trying it unless you feel reasonably confident in working with Windows and saving & copying files.  If you want to have a go then you'll need the aplet Development Kit (ADK39) which lets you edit Notes, Programs & aplets.

Step 1:    Download a copy of the ADK39 and install it.
If the ADK39 is not on your computer then you will need to install it.  You will need the ADK for the HP38G and the ADK39 for any later models. The ADK and ADK39 are free software from Hewlett Packard and can be downloaded from my Utilities page.

Step 2:    Transfer a copy of the damaged files.
It's best to put a copy (a copy!) of the set of Notes you are working with (all of them, not just the damaged ones) into a directory inside the directory into which the ADK was installed.  It's easiest to work on them in that location and it's also best to work on a copy rather than the originals in case something goes wrong.  If you're confident you know what you're doing then you can work on them wherever they are currently.

Make sure that the two special files called HP39DIR.CUR and HP39DIR.000 go with them.  These two files contain a record of the Notes - their filenames & their names as they appear on the calculator - and they are what we're going to be trying to repair.  From now on I'm going to refer to this as the 'Notes directory'.

Step 3:    Assess the damage.
You need to know which files are damaged so that you can repair them.  You may already know.  If not, there are two ways you can find this out.  The first (and slowest) is to use the Connectivity Kit and try to download each one.  Write down the names of the ones that fail.  The faster way is to run the ADK and use the File - Open command to try to open each of the files in the directory (except the two special files HP38DIR.000 and HP38DIR.CUR).  Make a note of the ones which don't open.  Close them all when you're finished.
If they all open but you still can't access them from the calculator then it's the two special files HP39DIR.CUR and HP39DIR.000 that are the damaged ones. If they are then the message you're getting from the calculator was to ask you if you want to "Initialise the directory". You may have said yes and then been concerned when it subsequently told you that there were no notes stored anymore.

Step 4:    Collect information prior to repair.

  1. Do this step if it was not an individual note damaged but the HP39DIR files. ie you're not able to even SEE any notes listed on the calculator, let alone retrieve them.
    1. In Windows, delete the two HP39DIR files.
    2. Start the ADK and use the File/Open command to open any note in the folder. The aim here is just to get the ADK program focussed on the folder containing the notes so you can close it again afterwards.
    3. On the File menu you will see a command called 'Aplet Library'. This is the command used to create those special files if they haven't been by the calculator. Run it now and you'll see the window illustrated in the section below. The difference will be that the left hand window will be empty and the notes will be listed in the right hand lower window.
    4. Highlight each of the notes in turn and click on the 'Add<=' button. They should transfer to the left hand winow.
    5. When finished, click on the 'Done' button. You will be asked if it is ok to recreate those special files. Tell it yes.

      You should now find that you can transfer the notes to the calculator. You don't need to follow any of the steps after this point.
  2. Do this step if it was an individual file that was damaged. ie you can see the notes from the calculator, you just can't retrieve them.

    You need to know that the name that a Note is given on the calculator is not likely to be the same as the filename it is given on the PC.  For example, a Note with a name of 'Chem Formulae' on the calculator would appear as CHEMFORM.000 on the PC.  A name of 'Maths' would appear as MATHS000.000  The Connectivity Kit removes any spaces and then gives it a name which is 8 characters long, padding it with zeros if needed or else chopping characters, and puts a .000 on the end.  The Connectivity Kit & the ADK are VERY old Windows programs and do NOT understand long filenames or the desktop, so don't try to use them.

    For each of the damaged files we need the filename and the name under which it appears on the calculator.  This information is contained in the special files HP39DIR.CUR & HP39DIR.000  We will use the ADK to examine them.  DO NOT edit these special files in any other way!

    On the File menu of the ADK you will see an entry called 'Aplet Library'.  Choose this and the dialog box below will appear.

    I created a set of four Notes to illustrate the process and then deliberately damaged the one called 'Chemistry Essays'.  You can see that the name isn't fully visible but it really doesn't matter - you can create the repaired version with any name you want, it's just best to aim for a similar one to the original for convenience more than anything.  Presumably you know by now which ones are damaged.  You need to record the filename (CHEMISTR.000) and the Object Name (Chemistry Essays) for later use.  When you've done this, click on the damaged note in the left hand window and then on the 'Remove =>' button.
    Click on the Done button when you have finished.

Step 5:    Repair the file.
The process of repair involves creating a new Note, then opening the old Note in Notepad and copying the contents of the new Note into it.

Create a fresh Note on the calculator.  You will probably want to give it a similar name (best if it's not identical) but you can call it anything you want.  Use the Connectivity Kit to copy this fresh, undamaged Note up into the same directory in which you're working.

Run Notepad from the Start menu in Windows (click on the Start button - it's usually found in the Accessories menu but you might have to look for it).  Use its File - Open command to open the damaged file (my file was called CHEMISTR.000).  Remember that you're looking for the Windows name of the file, not the name of the Note on the calculator.  Notepad usually only shows text files (.TXT) and so you'll need to change this to 'All Files (*.*)' before the .000 files will be visible (see below).

Use the Edit menu to Select All and then to Copy.  Close the file and Notepad.

Now run the ADK and open the fresh Note which you created earlier and transferred to the computer.  Paste the text from the damaged file into this new Note.  There will probably be extra characters in it but don't muck around trying to edit the result at this stage.  You can always do that later - we just want to get it working first.

Now save the Note in the ADK (File/Save) and close the ADK.

Step 6:    Check that it now transfers to the calculator successfully
You should now find that the Connectivity Kit will successfully transfer the Note to your calculator.  If you want to you can now erase the old damaged files.  When you transfer the file to the calculator it will probably need some repairs but at least the major portion of it should be intact.

Step 7:    (Optional) Repair the Note
As I mentioned earlier, the problem with this rebuilding process is that the repaired Notes will probably have garbage in them.  The first of this is at the top of the file.  You will probably see something like 'HP39 AscC 16 Chemistry Essays'.  This is the record of the file's name and so forth - you can delete this immediately since your repaired file will have its own.  Normally this is hidden by the ADK and the calculator but when you open it with a word processor it becomes visible. If you were to look at your repaired file with a word processor (DON'T!) you would find that this line now appeared twice.  Damaging this info is the simplest way to make a file unreadable.

The other damage you will see is caused by the special characters which the calculator uses, such as the STO character(), the negative sign (which is different to the subtract sign), the squared sign etc.  These are stored in the Note using special codes and when you look at the file with a word processor you see the codes rather than the characters.  Cutting and pasting doesn't restore them, they still come through as strange codes.

The pictures below show 'before & after' examples of codes becoming visible.

You can repair the Note on your calculator (the simplest option if you're not sure what you're doing) or you can use the ADK (the faster option) in the same way that you would edit any other note.

An advantage of using the ADK for this is that if one of the codes appears in multiple places (such as the \178 above) then you can use the Edit - Replace command in the ADK to replace all of them at once.  If you're working on the calculator you'd need to do each one separately.  There is a button on the ADK tool bar  which gives you access to all the special characters in the same way as the CHARs button on the calculator.  Just replace one of the codes with the  button, then highlight and copy it.  Go to the Edit - Replace command, put the special code into the find box and paste the replacement character into the replace box, then click on Replace All.  Don't forget to save regularly in case something goes wrong.

Warning:    Although the ADK and the Connectivity Kit were written for Windows 3.1, I have found that they are both very stable under Windows 95.  The only exception I have found is that one of our library computers crashes in a smoking heap when you click on the  button, so it might be worth testing this on your computer before you start work.

If you are not sure what a code stands for, I have created a full list of all the codes. I've shown the first third of the codes below so that you can see what to look for. I would suggest going to the page showing the full list and printing it out if the damage is any more than just one or two characters.  Good luck!

37.  How do you convert complex numbers to polar form?

Question: ┐How can i change from polar coordinates to rectangular or rectangular
to polar?  For example, if i have
            6+j7  = 9.21  _ 49.4░
            4+j4  = 5.65  _ 45░
Submitted by:  Juan Manuel

Answer: When converting rectangular to polar, the simplest way in the HOME view is....
    1.  STO ()the complex number into Z1 (or Z2, Z3....)
    2.  ABS(Z1) will give the modulus and ARG(Z1) will give the argument. Remember to set the
        angle type to DEG or RAD in HOME MODES before you do this.

If you have the Connectivity Kit and cable to download from your computer to your calculator then you might like to use a little program that I wrote for my students called 'Rcis'.  You can download the program from the Miscellaneous section of my aplets page. You need to download this program into the Programs Cataloge (not the LIB
view) and then RUN it.  It asks you which of Z1...Z6 the number is stored in and gives you the number back in polar form.

Converting back from polar to rectangular... it's probably easiest to just enter it in r cis form.  For example, 5 cis 30  would be entered as 5(COS(30),SIN(30)) and the calculator will then convert and display as rectangular.

Update:  I recently discovered a much neater way to convert polar to rectangular.  If you look in the CHARS view you will find the character .  If you wanted to convert 5 cis 30  then just enter (5, 30) and the calculator will return the rectangular form.  See question #63 for a bit more info on this.

38.  What other ON+Key combinations are there?

The information below applies to the HP38G.  I may update this eventually for the HP39G.

You are probably already aware of the full reset and partial reset key combinations.  In addition to these two there are a number of others.  The information below was provided by Detlef Muller and came originally from information provided on an HP48 FAQ page by Dave Arnett, a member of the HP48 development team.  The explanations are his not mine.
Note:    1. These key combinations are for an HP38G.  The HP39G may be slightly different.
            2. SK1 is the left-most menukey (SK=SoftKey), SK6 the right-most:

This is the manual Coldstart.  It will break out of almost any hung program, and resets the operating system. Note that this is your next-to-last resort in a lock-up, so don't do this unless you really want to clear memory.
This is the Oops! key for ON codes.  For many ON sequences, this cancels the operation, so long as you press the SK2 before releasing the ON key.  Try it sometime, if you must, just so you remember it.  It can be a life-saver, in case of an accidental ON+SK1+SK2 in process, or even accidentally hitting ON during a plotting routine.
This will initiate a Warmstart (or soft reset).  You'll lose at least the HOME History, maybe some other VARs too. But it will often get you out of a locked up program or 'hanging' due to mis-matched statistical data, without the whole memory being lost.
Note:  Poking a paperclip into the hole on the back of the calculator is the same as doing ON+SK3.
Enters interactive test mode.  Don't enter this mode without saving anything which is important but then you can playaround.  Exit this test mode with Warmstart, ON+SK3.  When you first press ON-SK4, your HP will beep and you will see 3 vertical lines, one on each side of the screen and one in the middle. The tests are:
bullet[SK1]   Displays CPU speed
bullet[SK2]   LCD test.  Press Enter to cycle through the tests
bullet[SK3]   Internal ROM test
bullet[SK4]   Internal RAM test
bullet[SK5]   Keyboard test.  Starting with [SK1], press all the keys in order, left to right, top to bottom.  If all goes well, the HP will show "KBD1 OK".
bullet[SK6]   Partial keyboard test
bullet[PLOT]  ESD test monitor.  Battery status is shown by a value.
bullet[SYMB]  UART loop-back test
bullet[NUM]   Wired UART echo. Shows what cards are plugged in.  Press any key a few times.
bullet[UpArr] Blanks display
bullet[LIB]   Sends system time from IR port
bullet[VAR]   Receives system time from IR port (have another HP send it)
bullet[MATH]  IR loop-back test
bullet[LfArr] IR UART echo
bullet[HOME]  Shows test start time
bullet[SIN]   Shows test fail time
bullet[COS] [TAN] [XTT] [SQT] [(] [)] Looping test, interrupt it by pressing a key
bullet[ENTER] Initialize test times
bullet[-X]    Test fail summary
Starts a looping self-test mode.  Kinda dull after the first five minutes, but it keeps a rather solid tempo.  Exit with Warmstart, ON+SK3. When the HP38 is in test mode (ON-SK4 or ON-SK5), the test results that are displayed on the screen are also sent to the serial port at 9600 baud, 8 bits, no parity, 1 stop bit. This does explain, why the I/O annunciator lights up so much during the self test.
Screen dump utility. Pressing this while connected via cable to the Connectivity software will cause a copy of the current screen to be sent to the PC. You can then copy it and paste it into any other application which accepts graphics.
bulletON+[+] and ON+[-]
Adjusts display contrast.
The following is a quote from an HP newsgroup site: ON+[,] initiates Coma Mode and clears Warm Start Log.  In Coma mode, all the clocked activity is halted.  The battery power drain is basically the few nano-amps [nA] necessary to sustain your RAM contents.  The Warm Start Log is a nearly bullet-proof area of memory which keeps track of the last four hazardous events. View it using the command WSLOG.  This log is one of the few things not cleared by a Coldstart.  But it is cleared by ON+[,].  Enter Coma this way if you want to clear the Warm Start Log, if you are planning to study crystal healing in Tibet for a few years and want to keep your pirated version of Tetris alive, or you just have a low power fetish.  Exit Coma mode with the ON key (tough to remember, huh?), and plan to find your stack cleared out.
Two additional notes on this Coma stuff.  First, I'm not gonna try to list the log codes in WSLOG.  Sorry!  Second, if your machine is on, and you drop the batteries out, you will usually end up in a coma mode to preserve power.  WSLOG will not be cleared.  Instead, you will find a code 1 entry there.  Some people are paranoid and want to be in Coma when they change batteries, just in case they have a sudden emergency call from the Prime Minister and don't get back to their battery change for a half hour.  If you are one of these...  shall I say, weenies?  No, that would be unprofessional ...users, then I recommend you use the ON+[,] entry route, rather than the kamikaze method of dropping batteries with the machine running.  Myself, I just turn the machine OFF, like the manual says. Now, a Coma story... sort of.  During the G/GX development, Imaintained a small number of units on which I changed ROM chips as incremental code releases came out.  This was so folks like Bill Wickes and Jim Donnelly could have fully-real hardware to test, instead of just the EPROM handsets some of you may have seen.  We always backed up anything of importance in the machine before we did this.  But I got into the habit of using ON+SPC (Coma on a '48) before I opened up the calculator.  Better than half of the time, I could remove the batteries, open the case, desolder the old surface-mounted ROM chip, solder down a new chip, and reassemble the machine... with all of RAM intact! When I pressed ON, I'd come right back up without a "Try to Recover Memory?" prompt.  Pretty good, huh?  The folks who put that mode into the machine certainly weren't in a coma.

39.  Why are programs on the HP larger than those on the Casio?

Question: I've been wondering why the HP programs use so much memory. The actual text files containing the programs should only be at most 500 bytes as they are only a page long. When I put them onto my calculator and run them the first time they take up approx 5k or more. Why? And is there another programing language I can use so that these simple short programs don't take up all my space. (I have a friend who uses the Casio and almost identical programs only use 50-100 bytes on his calculator).
Submitted by:  Alan Benn

Answer: The answer comes in two parts.  The first question is answered by Jean-Yves Avenard of HP - a guru programmer on the HP.

The calculator stores a program in a text file format. When you run this program for the first time, the calculator will first compile this program into a binary form that may be much bigger than the text source code. Then it runs the program. That's why the first execution time is much longer than next execution time.

The Casio or TI use an interpreter instead of a compiler. So, it takes less memory and the execution always takes the same amount of time. However, usually, a compiled program is much faster than an interpreted one. That's why on pure calculation inside a calculator a program is usually 3 to 4 times faster than the equivalent one on a Casio.

The second answer is from me:

Your second question was whether there is another smaller/better language.  Yes there is but it is not easy to learn.  The language you and I are using is called HP-Basic and there is also sRPL (System Reverse Polish LISP).  This language is right down at the level of "move this memory location to this one and add that one to it..."

The 39/40 series and the HP48/49/50 series (university level machines which are far more powerful) share the same Saturn chip and hence use the same language at this level.  It is quite difficult to use and very tedious to program in. If you're interested in learning it then look on my Help page in the section on programming. You'll find a series of tutorials on how to use it. The advantage of doing it using sRPL is that it is blindingly fast and you can do all the things using sRPL that you can't do in HP-Basic because of the limitations of HP-Basic.

Examples of aplets written in sRPL are most of the games, and the Datalogger aplet.  Only HP-Basic is covered in the manual that comes with the calculator.

Last modified: 19 Dec 2007                                             Sitemap        Home        Contact Me