Page 1 explains the HP Prime Programming Language (PPL): program structure, objects, variables and scope, operators, tests, branching, loops, functions, errors, input/output, graphics, strings, lists & matrices, apps & views, user keys, CAS access, base integers, idioms; a drawing of the keyboard sits under the navigation bar and the Toolbox menu tree follows the guide. The following pages index every command, function and system variable in the User Guide's Functions & Commands, Programming, Variables, Lists, Matrices, Units and Geometry chapters by category and subgroup. Hover any entry for its syntax, description and example. The last pages cover Python — MicroPython, the hpprime bridge, every module — and the calculator itself: its files and its electronics.
Each key carries up to three functions: its own legend, the blue one printed on its lower-left after Shift, and the orange letter or symbol at its lower-right after ALPHA. The black block at the top holds the app keys — Symb, Plot, Num are the three views of the current app, gives each its Setup — with the rocker wheel for the cursor and Help, Esc, CAS, Home, View, Menu around it. The bottom line of the screen is a row of six touch buttons that change with the view.
Key codes for GETKEY run 0 (Apps) to 50 (+), left to right and top to bottom — see User Keys & Key Codes.
| Element | Notes |
|---|---|
EXPORT f(…) | Global: callable from Home, other programs, the User menu (Toolbox ▸ User). Without EXPORT the function is private to the file. |
f(…); above header | Forward declaration — needed when a function is called before it is defined in the file. |
EXPORT V; / EXPORT V:=1; | Global user variable (Vars ▸ User). Put it above the function that assigns it. |
// text | Comment to end of line. |
#pragma mode(…) | Pins separator / integer settings for the compile (Shift Menu ▸ Insert pragma). |
| Name rules | Letters, digits, _; must start with a letter; case-sensitive. Reserved names (A–Z, L1, M1, Xmin…) cannot be program or variable names. |
NAME(3,4) Enter — a program with parameters prompts for them when run from the catalog.START(); with several EXPORTed functions it lists them.RETURN value, else the last statement's value.EXPORTed functions in one file appear as a folder in the User menu (delete the auto template first).Cmds menu (Strings, Drawing, Matrix, App, Integer, I/O, More) · Tmplt menu (Block, Branch, Loop, Variable, Function) inserts structures with blanks · Check = syntax check · Shift Menu = Create user key / Insert pragma · Shift 1 = Program catalog.
| Type | Literal / example | Notes |
|---|---|---|
| Real | 3.14 1ᴇ−3 −5 | 12 significant digits, exponent ±499. TYPE=0. Home vars A–Z, θ. |
| Integer | #1101b #FFh #17o #42d #FF:24h | Base-marked binary integer; wordsize 1–64 (:bits). TYPE=1. |
| String | "text" "say ""hi""" "a\nb" | Double the quote to embed it; \n newline, \\ backslash. Join with +. TYPE=2. |
| Complex | (3,4) 3+4*i | Z0–Z9. TYPE=3. |
| Vector / matrix | [1,2,3] [[1,2],[3,4]] | M0–M9. Elements M1(i,j). TYPE=4. |
| List | {1,"a",{2,3}} | Any mix of types, nestable. L0–L9. TYPE=6. |
| Expression | 'X^2+1' F1(X) | Single quotes prevent evaluation. Store in F0–F9, E0–E9 etc. |
| Function object | x→x^2 (CAS) | Mapping used by map/apply/select… TYPE=8. |
| Unit | 5_m 3_km/h | Number_unit. CONVERT(5_m,1_ft). TYPE=9. |
| Graphic (GROB) | G0…G9 | Screen is G0. Not assignable with := (use DIMGROB/BLIT). |
| Color | #FF0000 RGB(255,0,0) #FF:24h | Colors are integers 0xRRGGBB; alpha in high byte for PIXON. |
| Sexagesimal | 54°52′34.68″ | Shift a b/c key; →HMS/HMS→. |
| Interval / range | 1..5 x=0..2*π | CAS ranges for seq, solve guesses, delrows… |
TYPE(obj) → 0 Real · 1 Integer · 2 String · 3 Complex · 4 Matrix · 5 Error · 6 List · 8 Function · 9 Unit · 14.x CAS object. CAS type(x) returns DOM_… names.
| Kind | Where / rules |
|---|---|
| Home (system) | Reserved, typed, global: A–Z θ real · Z0–Z9 complex · L0–L9 lists · M0–M9 matrices · G0–G9 graphics · settings (HAngle, HFormat, Base…). Cannot hold another type or be deleted. |
| App | Reserved per app (Xmin, F1, C1, Root…). Same name in several apps ⇒ qualify: Polar.Xmin. Setting one changes the app. |
| CAS | Lowercase names, untyped, may stay symbolic. Home sees them too (5*q). |
| User | Created by assignment in Home (asks to confirm) or EXPORTed from a program; listed under Vars ▸ User next to the program. Untyped. |
| Local | LOCAL inside a function; disappears on exit; can hold any type; convention: lowercase names. |
X the Function app plots. Prefer LOCALs to avoid clobbering.MaxTemp ≠ maxTemp.EXPORT of the same name wins over an earlier program's.DelHVars("name"); app vars via DelAVars.HVars, AVars, Programs, Notes, AFiles read/write by name or index.| # | Highest → lowest (same level: left to right) |
|---|---|
| 1 | ( ) — innermost first |
| 2 | ! √ x⁻¹ x² |
| 3 | ⁿ√ (NTHROOT) |
| 4 | ^ 10ⁿ (ALOG) |
| 5 | negation, * / MOD (and implied multiplication 2X) |
| 6 | + − |
| 7 | < > ≤ ≥ == ≠ <> = |
| 8 | AND NOT |
| 9 | OR XOR |
| 10 | left argument of | (where) |
| 11 | := |
= builds an equation (for solve/E1); == tests equality; := assigns. In RPN entry mode operators execute immediately (Home only).
IF/WHILE/UNTIL treat any non-zero as true.IF with a list test: both branches must return single objects or equal-length lists (element-wise selection).ASIN(2)) need HComplex=1, else an error.ELSE IF keyword — nest ELSE IF … END; END; or use CASE.END takes a semicolon.PIECEWISE(c1,e1,…) and when(c,a,b) are the CAS/Symbolic-view equivalents of IFTE.MAKELIST, ΣLIST, EXECON, map, MAKEMAT.ITERATE(expr, var, start, n) applies expr n times.TYPE yourself, or pass a list).RETURN expr; ends the function; RETURN; alone returns nothing. Recursion is allowed.RETURN {a,b};).EXPORT is visible only in its file.DEFINE (Shift x t θ n) creates simple one-line user functions without a program.THEN, Ans holds the error number.DEBUG(prog)) steps line by line: Step, Skip, Vars (watch), Stop, Continue. KILL; stops a debug run.breakpoint/halt pause CAS programs.TEVAL(expr) seconds; TICKS ms since boot (t:=TICKS; …; (TICKS-t)/1000).PRINT(x) writes to the terminal (Esc/any key hides it; PRINT() clears).MEMORY() free RAM/flash; VERSION firmware.[0] real, [2] string (quotes hidden), [-1] any; several allowed [0,2].FREEZE or WAIT to hold graphics.G0 = screen, G1–G9 off-screen buffers (lost at power-off). Two coordinate systems: plain names use the current app's Cartesian window (Xmin…Ymax); _P versions use pixels (0,0 top-left → 319,239). Colors: RGB(r,g,b[,a]) or #RRGGBB; alpha ≥128 in RGB = transparent.
Optional args fill left to right: RECT_P(40,90,#000000) = x1,y1,edge. Plot-view background images: ImageName/ImageDisplay vars. Geometry-app plots use plotfunc, polygon… (CAS).
"" quote, \n, \\. Strings compare with ==, < lexically.+; for many pieces collect in a list.STRING(x,2,3) = FIX 3; STRING(x,3,4) = SCI 4.Programs("NAME"), notes via Notes("name").Functions return values and leave variables alone (TRN(M1)); commands (ADDROW, DELCOL, SCALE, SWAPCOL, REDIM, REPLACE, SUB) change the named variable. Vectors are 1-row: [1 2 3]. Lists hold anything; matrices hold numbers.
| STARTVIEW n | View | n | View |
|---|---|---|---|
| 0 | Symbolic | 7 | View menu |
| 1 | Plot | 8…13 | Special views (Split Plot Detail, Split Plot Table, Autoscale, Decimal, Integer, Trig in Function) |
| 2 | Numeric | −1 | Home |
| 3 | Symbolic Setup | −2 | Home Settings |
| 4 | Plot Setup | −3 | Memory Manager |
| 5 | Numeric Setup | −4 | App Library |
| 6 | App Info | −5…−8 | Matrix, List, Program, Notes catalogs |
View functions take no parameters — pass data through EXPORTed variables. Export those from a separate program called in START() so values persist. Icons/notes: ANote, AFiles("icon.png").
Prefixes: K_ plain · KS_ Shift · KA_ Alpha · KSA_ Shift+Alpha. Names (case-sensitive): Apps Symb Up Help Esc Home Plot Left Right View Cas Num Down Menu Vars Math Templ Xttn Abc Bksp Power Sin Cos Tan Ln Log Sq Neg Paren Comma Enter Eex 0–9 Div Alpha Mul Minus On Dot Space Plus. Activate: Shift Help (User) = one-shot user mode (1U in the title bar); Shift Help Shift Help = persistent (↑U) until pressed again.
| Row | Codes |
|---|---|
| Apps Symb ▲ Help | 0 1 2 3 |
| Esc Home Plot ◀ ▶ | 4 5 6 7 8 |
| View CAS Num ▼ Menu | 9 10 11 12 13 |
| Vars Toolbox Templ xtθn a b/c ⌫ | 14 15 16 17 18 19 |
| x^y SIN COS TAN LN LOG | 20 21 22 23 24 25 |
| x² +/− ( ) , Enter | 26 27 28 29 30 |
| EEX 7 8 9 ÷ | 31 32 33 34 35 |
| ALPHA 4 5 6 × | 36 37 38 39 40 |
| Shift 1 2 3 − | 41 42 43 44 45 |
| On 0 . Space + | 46 47 48 49 50 |
Soft-menu taps and screen touches come through MOUSE (or WAIT(-1) on newer firmware), not GETKEY.
solve, not SOLVE — that is the Solve app's function). Home functions are uppercase and also usable inside CAS.approx() or evalf, or store into a Home real to force a number.#CAS … #END blocks; older: create the function in CAS view with name(x):=….# are reals; mixing a real in gives a real result.#FF0000h is not needed — drawing commands accept plain #FF0000.The bundled User Guide is the 2018 edition (firmware 13333). Physical Primes and the 2.1.14425 macOS emulator run later firmware. Additions below are widely documented by HP/community but are not in the guide — verify on your unit. Python has its own section at the end of this sheet, checked on firmware 2.2; the lines here are only the PPL-side syntax.
#PYTHON is a pure Python program (Python App / hpprime module; from hpprime import * and from graphic import *).WAIT(-1) blocks until a key or touch and returns the key code, or a list {type,x,y} for mouse events.TEXTSIZE(str,font) → {w,h}; TEXTOUT fonts 1–7 / pixel sizes 10–22 in later builds.ICON resources in app files, larger Programs/Notes support, more STRING options, MOUSE improvements, Python hpprime graphics (fillrect, blit).The Prime has no soft-key menus in the 48/50 sense: the six touch buttons along the bottom of the screen belong to the current view, and the big function menus live behind the Toolbox key (the little tool-box icon, row of Vars). It opens a full-screen menu with five tabs — Math, CAS, App, User, Catlg — each a list of categories that cascade to the right into their entries and sub-menus. Navigate by touch, or with the cursor keys and Enter; every entry is numbered, so typing 2 then 3 inside Math picks Arithmetic → Modulus without looking. Esc leaves the menu; there is no “up” key — the tabs are always one tap away.
Picking an entry pastes the function into the entry line with its parentheses (MOD(, simplify(). By default the menus show the descriptive names used in the trees below; turn off Menu Display in Home Settings to see the command names from the index instead. Math functions are UPPERCASE and work everywhere; CAS functions are lowercase and, from a program, are called as CAS.name().
Menu contents follow the HP Prime User Guide (2018): “Math menu”, “CAS menu”, “App menu” in Functions & commands, and the List and Matrix chapters. Newer firmware adds entries (Python, Graph 3D) without changing the tree.
is the blue Shift key; the orange ALPHA key gives the orange letters. Shifted functions are printed in blue on the key itself, alpha letters in orange at its corner — see the keyboard at the top of the page.
Firmware 2.1.14181 (2021) and later carry MicroPython 1.9.4 — Python 3.4 syntax — as the Python app plus a bridge module, hpprime. Your Prime reports sys.version 3.4.0, sys.implementation (micropython, 1.9.4), sys.platform 'HP Prime' and a 1,024,512-byte heap.
3. The Python app (Apps → Python): Symb is the script editor (Tmplt and Cmds menus; select a command and press Help for its page), Num is the console — single-line entry, output history above. The console auto-imports every script of the app as import name, so call name.func() or type from name import * yourself. Plot opens the app settings, where the heap size is set. On interrupts a running script.
Block names carry no .py; PYTHON(name) takes the bare name, unquoted. Keep the block name different from the EXPORT name. From the Mac, tools/tohp --program file.py wraps a script this way and sends it; the Connectivity Kit edits programs and drops .py files onto the Python app.
Getting a result back to PPL: store it with eval("V:=…") or eval('AVars("X"):=…'), or write a Note with eval('Notes("R"):="…"') (how this sheet’s probes reported). Inside that PPL text a backslash or a double quote ends the string early — strip them (repr() of a multi-line string puts \n in) — and numbers like 2e+1 can trip the parser: format them yourself or go through cas.caseval.
The first argument of every drawing call is the graphic number: 0 is the screen, 1–9 are the off-screen buffers G1–G9 shared with PPL. Colours are 24-bit ints (0xFF0000 red, or eval("RGB(r,g,b)")); the screen is 320 × 240, (0,0) top-left. Each function has a _c twin using the Cartesian window from set_cartesian.
Codes: Apps 0 · Symb 1 · ▲ 2 · Help 3 · Esc 4 · Home 5 · Plot 6 · ◀ 7 · ▶ 8 · View 9 · CAS 10 · Num 11 · ▼ 12 · Menu 13 · Vars 14 · Toolbox 15 · Templ 16 · xtθn 17 · a b/c 18 · ⌫ 19 · xʸ 20 · SIN 21 · COS 22 · TAN 23 · LN 24 · LOG 25 · x² 26 · +/− 27 · ( ) 28 · , 29 · Enter 30 · EEX 31 · 7 32 · 8 33 · 9 34 · ÷ 35 · ALPHA 36 · 4 37 · 5 38 · 6 39 · × 40 · Shift 41 · 1 42 · 2 43 · 3 44 · − 45 · On 46 · 0 47 · . 48 · ␣ 49 · + 50
Not in 3.4 / 1.9.4: f-strings, the walrus :=, async/await keywords beyond the basics, type hints are parsed but ignored, dataclasses, match. Recursion is shallow (~77 levels on a G1, ~99 on a G2) unless PYTHON() is given a bigger stack.
Present (probe, 2026-08-30): hpprime, cas, graphic, matplotl, linalg, arit, math, cmath, urandom, sys, gc, micropython, array, ucollections, uerrno, uhashlib, uio, ure, ustruct, utimeq, builtins. Everything else in the MicroPython manual is absent — notably time, utime, os, json, random, collections, io, re, struct, itertools, functools, string, copy: use the u-prefixed names (urandom, ucollections, uio, ure, ustruct) and reach PPL for time.
hpprime (arc arc_c blit blit_c circle circle_c dimgrob dimgrob_c eval fillrect fillrect_c get_cartesian grobh grobh_c grobw grobw_c keyboard line line_c mouse pixon pixon_c rect rect_c set_cartesian strblit strblit2 strblit2_c strblit_c textout textout_c) is HP’s bridge and fast-drawing module, detailed in the cards above. The other five come from Bernard Parisse’s Xcas/KhiCAS work and mirror what NumWorks and Casio users know:
Function-by-function detail is in the Python index below; the Cmds menu of the Python app lists the same names and Help explains each one.
import gc); raise it in Plot settings or per call with PYTHON({name, bytes}). gc.mem_free() tells you where you stand; gc.collect() reclaims.time is absent. Busy-wait on eval("TICKS"), or eval("WAIT(0.1)").from x import *. Blocks in PPL programs are invisible to the app.eval('"abc"').tohp works around it; irrelevant on the keyboard itself.graphic.show_screen(), matplotl.show() and input() wait for a key — a script driven over USB looks frozen until someone presses one.Everything you create is an object in the calculator’s flash file system, and every object has a file form the Connectivity Kit shows as a folder tree: Programs, Notes, Lists, Matrices, Apps (each a folder), Variables, settings, exam configurations. This unit reports itself as software 2.2 (revision 15157, built 2024-09-01), CAS 1.5.0, MicroPython 1.9.4, hardware version C.
From a program, the same tree is a set of lists: Programs, Notes, AFiles, AVars, HVars each return the names (Python gets them as lists through hpprime.eval); VERSION returns the About text.
| Object | File · where | Format | Reach it |
|---|---|---|---|
| Program | .hpprgm — Program catalog ( 1) | UTF-16LE text, BOM optional; PPL source, may hold #PYTHON…#END and #cas…#end blocks | Programs("name") reads/writes the source from PPL; the Connectivity Kit editor; tohp --program from the Mac |
| App | Name.hpappdir — a folder (Apps key) | Name.hpapp (the app’s variables and state, binary), Name.hpappprgm (its program), Name.hpappnote (its Info note), icon.png, plus any attached files | AFiles / AFilesB list, read and write the attached files; AVars the variables; the Connectivity Kit app editor has Modes, Program, Info, Files, Variables tabs |
| Python script | .py — attached to the Python app | plain text; the app’s Symb view edits them, the Num console imports them (import name — call name.func()) | drop .py files onto the Python app in the Connectivity Kit; or keep Python inside a .hpprgm as a #PYTHON block |
| Note | .hpnote — Notes catalog ( 0) | UTF-16LE rich text | Notes("name") from PPL — a handy place for a script to write results (this sheet’s probe did exactly that) |
| List / Matrix | L0–L9 .hplist · M0–M9 .hpmatrix ( 7 / 4) | small binary records (an empty list is 8 bytes, an empty matrix 24) | the List and Matrix editors; L1 := {…} from Home or a program |
| Home variables | calc.hpvars | binary container (4-byte magic 7C 61 8A B2, shared by settings and app files) | A–Z, Z0–Z9 (complex), user variables; Vars key → Home |
| Settings | calc.hpsettings · cas.hpsettings · settings · Custom Mode | binary; “settings” carries the calculator name and serial number | Home (Home Settings), CAS; Custom Mode is the exam/custom mode definition |
| Exam & class | exam-mode configurations, .hppoll / .hpresult | Connectivity Kit objects | Exam Mode ( Esc from the Apps screen), polls sent by a teacher |
| Backup | Backups catalog on the calculator · .zip from the Connectivity Kit | a snapshot of everything above | Memory Manager ( Toolbox) → Backups; libhpcalcs “recv backup” drops every object as a file |
| Firmware | PRIME_OS.ROM + PRIME_APP.DAT (about 12 MB) | signed OS image | installed by the Connectivity Kit, or from a USB drive on a G2; the calculator keeps user data across updates |
Moving things: drag between the Connectivity Kit’s calculator pane and content pane; calculator-to-calculator over the USB cable or the wireless kit via Memory Manager (Clone / Send); from the command line with libhpcalcs (send file = menu 5, full backup = menu 7; single-file receive fails on fw 2.2). The Prime is a USB HID device, never a disk. Memory Manager ( Toolbox) shows what is using memory and holds on-calculator backups.
Two generations share one design: a single ARM system-on-chip with everything on it, one RAM chip, one NAND flash chip, and a keyboard/power board — HP used ordinary documented parts, no custom ASIC. The G1 (2013) is a 400 MHz ARM9; the G2 (2018) is a 528 MHz Cortex-A7 with eight times the RAM and roughly three times the speed.
| Model | NW280AA (2013) · mainboard EA656MB, keyboard/power board EA656KB |
| SoC | Samsung S3C2416XH-40 — ARM926EJ-S (ARMv5TEJ) at 400 MHz, 16 KB I / 16 KB D cache, MMU, 2-D accelerator, LCD controller, USB 2.0 device + host, NAND controller, ADC, RTC |
| RAM | Hynix H5MS2562NFR-E3M — 32 MB mobile DDR SDRAM (256 Mb, 4 M × 4 banks × 16) |
| Flash | Samsung K9F2G08U0C-SCB0 — 256 MB (2 Gb) SLC NAND; OS + user files |
| Battery | Li-ion 3.7 V 1500 mAh (5.55 Wh), WiseWod 484461AR, IEC 1ICP6/51/63 — up to ~15 h |
| Firmware | HP OS on a bare-metal RTOS; newRPL has a G1 port that drives this hardware directly |
| Model | 2AP18AA (2018), later G8X92AA |
| SoC | NXP i.MX 6ULL MCIMX6Y2 — ARM Cortex-A7 (ARMv7-A) at 528 MHz, NEON, MMU; LCD (eLCDIF), USB OTG, NAND (GPMI), ADC, PWM, RTC on chip |
| RAM | 256 MB DDR3 SDRAM |
| Flash | 512 MB NAND |
| Battery | Li-ion 3.7 V ≈ 2000 mAh — ~24 h of continuous use |
| Firmware | FreeRTOS-based HP OS; U-Boot/Linux have been booted on it; about 3× the G1’s speed |
| Display | 3.5″ 320 × 240 TFT, 16-bit colour (114 ppi), LED backlight (PWM) |
| Touch | capacitive multi-touch panel (two fingers — mouse() reports both) |
| Keyboard | 51 keys scanned as a GPIO matrix; codes 0–50 top-left to bottom-right; keyboard() returns the whole matrix as a bitmask |
| USB | micro-AB, USB 2.0. To a computer the Prime is a HID device (VID 03F0 HP) — not a disk; the Connectivity Kit, libhpcalcs and this sheet’s tohp talk HID reports. The G2 is also a host: USBOpen / USBSend / USBReceive drive an attached device |
| Wireless | HP Prime Wireless Kit: a 2.4 GHz module on the calculator’s USB port paired to a PC dongle (classroom use) |
| Other | real-time clock (Time, Date, TICKS ms counter), no beeper, no SD slot, reset pinhole above the battery door |
Sources: TI-Planet’s teardown of the DVT prototype (board and chip references), Wikipedia’s HP Prime article (G2 SoC, memory), TI-Planet’s G2 review, the newRPL Prime-G1 port in your tree (which drives the S3C2416 directly), the USB HID notes in retro/hp-prime. The G2’s RAM/NAND part numbers and both touch controllers are not published in any teardown I could find.