Thursday, September 26, 2013

HP Prime Tip: Setting Up User Keys

HP Prime User Keyboard Primer

On of the features of the new HP Prime is the ability to assign custom programs, mathematical commands, or constants to the keyboard.

In this tutorial, we will use the shortcut commands to set up a user keyboard. You can set one or many user keys, there is no required number. In addition, the user keyboard can take one of four planes:

Shift + Key
Shift + ALPHA + Key

We will illustrate the procedure by assigning the STRING() command to the
Change Sign [ +/- ] key.

1. Create a new program and give it any name you want. For this example, I name the program USERKEY. USERKEY is going to be where I store my user key assignments.

2. Clear the program editor. There should be no EXPORT-BEGIN-END structures on the screen.

3. Press the [Menu] key. The [Menu] key is on the upper right hand corner section of the keys, to the left of the [CAS] key and below the [View] key. Select option 4: "Create User Key".

4. At the "Press any key..." prompt, select the key for which you want to assign your command to.

For my illustration, I will press the [+/-] key.

5. The user key template will appear of the programming editing screen. In between the BEGIN and END; is where you will type.

Note that the appropriate key code will be entered for you.

6. Call the RETURN command by pressing the soft key (Tmplt) then selecting "Block" then "RETURN".

Type your command and program in quotes. You can also call them from the various HP Prime menus or the Catalog. It is very important that you end this line with a semicolon (;), otherwise a syntax error occurs.

Note that user key assignments and edits are saved automatically. There is no need to run the USERKEY program.

Illustrated below is me putting the STRING() command. This assigns the STRING command to the [ +/- ] key.

For additional key assignments, repeat steps 3-6. Each key assignment template stands alone. Do not nest key assignment templates.

To use a user-assigned key, first press [Shift] + [Help] (User). An orange "1U" indicator appears on the top left hand corner of the screen. This means the next key pressed will execute the user-assigned function (if there is one).

For my example, pressing [Shift] + [Help] (User), [+/-] brings up the STRING command.

That is all there is to it!

Be sure to take notes of your key assignments.

Look for additional HP Prime programming tutorials in the upcoming months.

As always thank you for your support and comments. Have a great day everyone,


This blog is property of Edward Shore. 2013


  1. This is a very good tutorial! When I first got my Prime, I was baffled by the apparent lack of Userkey-setting functions. I think the new key method is pretty cool, but it lacks the ability to assign keys programmatically, which is something I used in my HP 50g quite often.

  2. Thanks for the tutorial. I would love similar posts.

  3. I aim to set up tutorials like this in the coming months. Thank you all for your feedback!

  4. Thank you very much! Your tutorials on programming HP Prime are amazing! I'm now trying my first app, and have one question. Is it possible to return value from the app in format e.g.: 1/(SQRT(3) * 7) instead of 0.08247...? See in the screenshot what I'm trying to do :)

    1. Try the exact command. exact is found in the catalog. Hope this helps, Eddie

    2. Thank you! This solved my problem! ;) Keep up the good work!

  5. can user keys be used to create custom units (gpm etc) and convert like 48sx cst menu

    1. John,

      Hope you are doing well. I vacationed in San Luis Obispo and Morro Bay - beautiful area! I want to go back.

      I have not seen a built in facility to create custom units through the Units menu, so I am using the User Key approach.

      Regarding custom units, we need to use the exact syntax or an error occurs. The general format for any unit is number_(unit). The unit must be in parenthesis. It seems like custom units are connected by the multiplication symbol (*) and the reciprocal symbol (^-1).

      So set up a program (I called it CUSTOMUNITS) that follows this format:


      // User Key 1

      KEY K_1()


      RETURN "_(galUS*min)";


      // User Key 2

      KEY K_2()


      RETURN "_(acre*ft)";



      Hopefully this helps.

      By the way, fps (feet-per-second) is found through the speed submenu of the Units menu.


  6. The custom software development services at Acetetch take into account your long term business benefits without compromising on the quality aspect while at the same time maintaining the best practices of software development.

  7. I still can convert mm to inches

  8. Thanks for sharing this list. Very grateful. I work at mobile app testing company where i think it will be definitely useful.

    123 HP dj3830

  9. Hi there, awesome site. I thought the topics you posted on were very interesting. I tried to add your RSS to my feed reader and it a few. take a look at it, hopefully I can add you and follow. 3830

  10. I know this is an older post, but I am trying to find an answer to the following:

    I had created a small RPN program that I stored as 'inmm' so I could type in a value in inches and then tap the inmm soft key to output a value in mm. My program was:
    <<25.4 * >>

    Is there a way to do this on the Prime so I can have the same functionality as I had with the HP50g?

    I know that there are user defined functions, but can these be assigned to a soft key? Or is there another way to do this?


    1. Unfortunately, I do not think programs can be created in RPN mode on the Prime. I suggest a regular program or a user function. In addition, the Prime does have a unit conversion menu.

  11. To clarify the above, the small RPN program I described above was done on my HP-50g.

  12. I ended up finding an app for that :-)

    The Units48 application for Prime seems to work nicely, and the soft keys can be used to assign units or to convert to a unit with the alpha key. I think that will serve my purposes just fine.

    I also did create a program that assigned some functions to user-defined keys, so I can still do that - but it is three button presses to convert while the 50g was a one-button conversion.



Calculator Python: Lambda Functions

Calculator Python: Lambda Functions Introduction to Lambda Functions Lambda functions are a quick, one expression, one line, python function...