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:

Key
Shift + Key
ALPHA + 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,

Eddie


This blog is property of Edward Shore. 2013

11 comments:

  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.

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

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

    ReplyDelete
  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 :) https://www.dropbox.com/s/biwam9favultjgj/Screenshot%202013-12-08%2016.44.55.png

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

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

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

    ReplyDelete
    Replies
    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:



      // CUSTOMUNITS




      // User Key 1

      KEY K_1()

      BEGIN

      RETURN "_(galUS*min)";

      END;




      // User Key 2

      KEY K_2()

      BEGIN

      RETURN "_(acre*ft)";

      END;



      etc...



      Hopefully this helps.



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



      Eddie

      Delete
  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.

    ReplyDelete
  7. I still can convert mm to inches

    ReplyDelete
  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

    ReplyDelete

HP Prime and TI-84 Plus: Basic Wheatstone Full Bridge Circuit

HP Prime and TI-84 Plus:  Basic Wheatstone Full Bridge Circuit The program WHEATSTONE (HP Prime) and WHTSTONE (TI-84 Plus CE) deals wi...