Operating the handheld programmer — the 7 onboard keys
The Steamania handheld programmer (ELAB-N1) has two human-interface channels:
- The main screen — a self-contained touch UI. It talks to the MCU over UART3 and is operated by touching it. Its touch operations are out of scope here.
- The OLED screen + 7 keys — the subject of this manual. With the seven keys alone you can browse, write, edit, run and single-step-debug programs, manage archives and configure the network.
1. The seven keys
| Key | Program-visible port |
|---|---|
Function | Port0 bit 6 |
Up | Port0 bit 0 |
Down | Port0 bit 1 |
Left | Port0 bit 2 |
Right | Port0 bit 3 |
Enter | Port0 bit 4 |
Back | Port0 bit 5 |
The same keys double as program input controls: user programs read them as Port0 bits 0–6 (e.g. with TZ jumps), so a button can be both "operator control" and "program input".
2. Global key conventions (any page, browsing state)
| Gesture | Effect |
|---|---|
Left + Right together | Flip page — Right = next, Left = previous, wraps around |
| Flip until the OFF page | Screen goes dark (power-save) |
Hold Function + press Enter | Wake the screen back up |
Page flipping is blocked while editing a line, editing a file name, or inside run-control mode — keys mean something else there.
3. The page map (OLED screen)
Left+Right walks this ring; page numbers are also the value of display register 0x81. For how to operate each page see §4.
| Page | Name | Purpose |
|---|---|---|
0x00 | OFF | Screen dark |
0x01 | Debug status | Delay / AD / PWM / switch regs / tick (read-only) |
0x02 | (blank) | — |
0x03 | (blank) | — |
0x04 | Link monitor | RX/TX 16 bytes each in hex + counters, headers inverted, Enter freezes |
0x05 | Program | Browse / edit / run the program — the main workspace (§5–§6) |
0x06 | Save / Load | Archives: save, load, rename |
0x07 | Peripherals | 8 peripheral ON/OFF toggles + GPIO direction editor |
0x08 | Analog in | ADS1115, all 16 channels (read-only) |
0x09 | BLE console | ROLE / NETID / MADDR configuration |
0x0A | Examples | Example-program browser |
0x0B | BLE baud | Baud-rate scan & set |
0x0C | STARNET cfg | HELLO / controlled-switch / heartbeat period |
0x0D | Neighbors | Online devices with latest reported value |
0x0E | Monitor | Last 5 frames, newest first |
0x0F | Statistics | RX counters, own address, role |
0x10 | ENV cfg | Reserved |
0x15 | Clock adjust | Time setting |
0x16 | Test | Reserved |
0x20–0x2F | Registers | Internal registers, 16 read-only pages covering all 256 |
0x30–0x31 | File names | Archive file-name list (read-only) |
4. Page-by-page guide
Page 00 — OFF
Screen dark (power-save). Hold Function + press Enter to wake the display.
Page 01 — Debug status
Read-only debug page. No keys. It shows:
| Row | Content |
|---|---|
| Delay set | Current system delay setting (ms) |
| First row, 4 cells | AD channel 0–3 voltages |
| Second row, 4 cells | PWM channel 1–4 duty cycles |
XXXX/XXXX | Peripheral switch register (hex) / peripheral-ready status |
| Last row | Timeout flag / system tick value / target tick |
Page 04 — Link monitor (RX + TX)
One page for both directions: the upper half RX (last 16 bytes received), the lower half TX (last 16 bytes sent), each as a 2×8 hex grid. The top line shows both frame counters R:nnnnnn T:nnnnnn.
Known headers are shown inverted (white-on-black):
| Header | Meaning |
|---|---|
F1 DD | Mesh link-layer header |
7E | Compact-frame header |
AA ? 0A | Transparent header |
Bytes that are NOT inverted are garbage that failed validation and was discarded — perfect for explaining in class which packets get accepted and which get thrown away.
| Key | Action |
|---|---|
Enter | Freeze / unfreeze: latch both RX and TX snapshots at once (top line inverts); press again to go live. While frozen, new frames don't disturb the display |
Page 05 — Program (main workspace)
Browse, edit, run and single-step-debug programs — the busiest page. See §5 (browsing & editing) and §6 (run control & step debugging).
Page 06 — Save / Load (archives)
16 archive slots: save, load, rename.
| Key | Action |
|---|---|
Up / Down | Pick a slot (> mark) |
Enter | Load the program in that slot |
Hold Function + Enter | Save the current program into that slot (keeps the name) |
Function once | Rename that slot → opens the file-name editor |
Back | Back to the previous page |
Left / Right alone | No function (Left+Right page flip still works) |
File-name editor (entered with one Function press):
| Key | Action |
|---|---|
Up / Down | Character ±1 (printable ASCII, wraps; hold ≥0.5 s auto-repeats) |
Left / Right | Move the cursor (16 characters) |
Enter | Confirm the name and save to Flash |
Back | Cancel, back to the slot list |
Page 07 — Peripherals
9 items across two screens: ADS1115, BME280, DS1307, TCS34725, PCA9685, WS2812B, HuskyLens, MIDI, GPIO direction.
| Key | Action |
|---|---|
Up / Down | Move between items (wraps) |
Left / Right | Previous / next screen (5 rows each) |
Enter | Toggle the selected item ON/OFF (turning ON probes it once; GPIO direction opens the sub-page) |
Function | Re-probe every ON peripheral at once (shows RETRY) |
Back | No action |
GPIO direction sub-page (press Enter on the GPIO direction item): the 8 bits of Port1 laid out in one row.
| Key | Action |
|---|---|
Up | Set the current bit to input (1) |
Down | Set the current bit to output (0) |
Left / Right / Enter | Move the cursor (wraps) |
Back | Return to the list; directions take effect automatically |
Function | Force-refresh the GPIO directions now |
In ENV mode, Function doubles as the ledger pump switch on this page (teacher demo polling of sensor representatives).
Page 08 — Analog in
Read-only. A 4×4 grid shows all 16 ADS1115 channels. No keys.
Page 09 — BLE console
Configure the BLE module ROLE / NETID / MADDR. On-screen hints: browsing FN:EDIT U/D:ROW, adjusting L/R:ADJ ENT:SET.
| Key | Action |
|---|---|
Up / Down | Pick a row (ROLE / NETID / MADDR) |
Function | Enter / leave adjust mode |
Left / Right | Value ±1 while adjusting |
Enter | Write to the module while adjusting (SET OK / SET FAIL for 1.5 s) |
Page 0A — Examples
| Key | Action |
|---|---|
Up / Down | Browse examples |
Enter | Load into the program area |
Page 0B — BLE baud
Entering the page auto-scans the current baud rate (FOUND / NO RESP).
| Key | Action |
|---|---|
Function | Enter / leave edit |
Up / Down | Pick a baud rate |
Enter ×2 | Press twice to commit |
Page 0C — STARNET cfg
4 rows: HELLO, CTRL (controlled-switch), HB (heartbeat period), last-report status.
| Key | Action |
|---|---|
Up / Down | Pick a row |
Function | Enter / leave adjust mode |
Left / Right | While adjusting: CTRL row toggles ON/OFF; HB row cycles OFF→1S→5S→10S |
Enter | While adjusting, on the HELLO row: broadcast HELLO (sent → SENT, not sent within 2 s → FAIL) |
In PASS (transparent) mode the page still opens, but HELLO sends nothing and shows FAIL after ~2 s — expected, not a fault.
Page 0D — Neighbors
Online network devices (B=broadcast / P=peer) with their latest reported value. Up / Down scroll.
Page 0E — Monitor
Read-only. Last 5 frames, newest first (type / source / first byte).
Page 0F — Statistics
Read-only. RX counters, own MADDR, role.
Page 10 — ENV cfg
Reserved.
Page 15 — Clock adjust
| Key | Action |
|---|---|
Enter | Invoke adjust (cursor at year); press again to commit and exit |
Left / Right | Switch field: year→month→day→hour→minute→second |
Up / Down | Current field ±1 |
Back | Discard changes |
Leaving the page discards uncommitted changes.
Page 16 — Test
Self-test screen, no key operations.
Page 20 – 2F — Internal registers (16 pages)
Read-only register viewing, 16 per page: Page 20 = 0x00–0x0F … Page 2F = 0xF0–0xFF. Press Function once to enter run-control mode (§6).
Page 30 – 31 — File names
Read-only list of all archive slot names. Renaming is done from Page 06.
5. Program page in depth: browsing & editing
The OLED shows 4 program lines at a time; the header shows the current file name and [pc]<.
Browsing
| Keys | Effect |
|---|---|
Up / Down | Scroll ±4 lines |
hold Back + Up/Down | Scroll ±128 lines |
Left / Right | Scroll ±16 lines |
Function+Up / Function+Down | Jump to first / last line |
Function+Left / Function+Right | Scroll ±64 lines |
hold Back ≥ 400 ms | View follows the program counter (PC) |
Editing — press Enter on any line. Three stages:
- Pick line —
Up/Down±1 line; holdEnter+Up/Down= ±32; holdBack+Up/Down= ±128.EnterorRightconfirms the line;Back/Functionaborts back to browsing. - Pick field — a program line is
inst + P00 + P01 + P10 + P11(5 bytes).Left/Rightmoves between fields; holdBack+Left/Rightjumps to first/last field. - Change value —
Up/Down±1 (wraps 0↔255); holdEnterfor ×16 speed.Functiontoggles byte / nibble granularity (nibble = one hex digit).Left+Righttogether zeroes the current field.Enterwrites the line back;Backdiscards.
Nibble mode is handy for opcode entry straight from the instruction set: each hex digit of inst P-0 P-1 is its own cursor position.
6. Run control & step debugging
Press Function once on the program page (or any register page 0x20–0x2C) to enter run-control mode — the top-bar icons invert as a hint. The keys become a debugger:
| Key | Action |
|---|---|
Right | Run / pause toggle (STOP→RUN; RUN→pause in step mode) |
Left | Stop and reset PC to line 000 |
Enter | Execute one line (single-step, only while paused) |
Function | Leave run-control mode |
Up/Down/Back do nothing in this mode. This is what course slides call 单步调试 (step debugging) — pause with Right, then walk line by line with Enter, watching registers and outputs change.
Over the air the same debugger is control-frame opcode 0x07 RUN_CTRL (run / stop / step / n / jump / b) — see the STARNET documents.
7. Startup key combinations
Hold keys while powering on:
| Held at power-on | Enters |
|---|---|
| (none) | Normal startup |
Left + Right | Servo action mode (PCA9685 16-ch PWM) |
Back | ENV mode — UART2 handed to the AS32 radio at 9600-8-N-1, screen shows a blinking @ |
| (preset combos) | Start a preset archive directly — each archive binds one function and one device ID |
Link mode is chosen once at power-on; switching modes always means a reboot.
8. Course-term cheat sheet
| Slides say | Do this |
|---|---|
| 单步调试 | §6 — Function, pause with Right, walk with Enter |
| 翻页 | Left+Right together |
| 下载/载入范例 | Page 0A examples |
| 改程序 | §5 editing flow |
| 点名 | Page 0C → Function to adjust → Enter sends HELLO, watch Page 0D |