RF Eclectica Wiki

Try to learn something about everything, and everything about something - Thomas Huxley

User Tools

Site Tools


public:calculator:guides:hp16c_emulator

Calculator Hints & Tips

DM41X HP16C Module

Keyboard Overlay

Background

The HP16C Programmer's Calculator is made for manipulating numbers in Binary/Octal/Hexadecimal/Decimal to help with programming and other areas that rely on the nitty-gritty of bit-twiddling.

Swiss Micros make a modern hardware emulation (similar in form to the DM15L I already own) but rather than adding another calculator to my (growing) collection I found there is a ROM/Module method to add all (and more) the same features to the DM41X (and presumably the HP41, if you can find a hardware ROM plugin with it).

I occasionally need to do some conversions/calculations into Hex and Binary (thinking of TCP/IP networking, subnet masks etc. or perhaps debugging RS232 serial data, or when writing rig control software?) and being able to do everything on the DM41X (along with the Complex Number module) means the DM41X will become even more useful day-to-day.

The manual for the HP16C Module hp_16c_emulator_manual.pdf

The versions of modules I'm using : hp-16c_rev.1a.zip

The HP16C

The DM16L

Basic Operation

Like the 41Z Complex Number module, a USER keyboard assignment is made to a trigger command which then automagically re-maps the whole keyboard for one command, then it reverts to normal. A mental image of the re-mapped keyboard starts to develop with use, making operation easier with time.

I've assigned the LN key to the trigger command 16C for the USER keyboard

SHIFT ASN ALPHA SHIFT 1 SHIFT 6 C ALPHA LN

User Keyboard comments

With USER keyboard active I generally won't miss the loss of LN as I rarely use it.

If I do need LN I can simply turn off the USER keyboard.

The same applies for using the ∑+ key for entering Statistical Data - it's assigned to the Complex Keyboard trigger ZKBRD.

I won't ever be using statistics at the same time as complex numbers (or HP16C functions).

The USER keyboard can generally remain active all the time except when I want to do statistics or calculate a natural logarithm. Two easy sacrificed keys. Are there others I can do without for additional assignments to frequently used functions or modules?

UPDATE 5/8/22 16KEYS? Y/N

I played with the LADYBUG module recently ( see DM41X Ladybug Module ) and enjoyed the more “immediate” keyboard input - with the whole keyboard re-mapped while using the module (in “INTEGER” mode). No need to preface each instruction with a trigger to enable the special keyboard for one command at a time.

I found that the HP16C Module can be switched to “full-time” 16KEYS mode too….

You need to get to the ∑BITS launcher and then select Y (for 16KEYS) and answer Y or N.

The 16KEYS function can't be reached any other way, that I've found. The simplest way is to use the DM41X CST menu to run the 16C ∑MOD launcher, then press SHIFT to switch to the ∑BITS launcher, then select Y (for 16KEYS).

You'll need to enable USER key mode, and then the 16C module can be used without the the need to trigger every command with 16C (normally ASN'd to LN key).

You still need to use 16NPT to input numbers (this is mapped to the A (∑+) key. Otherwise most things are just more intuitive. No need to use 16C before an arithmetic operation like + or - etc.

Example

Switch to BIN view

B

Enter a binary number 10111011

16NPT10111011ENTER

Convert to HEX

E

H: bb

Convert to DEC

D

d: 187

Enter a Decimal Number 23

16NPT23ENTER

d : 23

Add them

+

d: 210

Convert to BIN

B

b: 11010010

Much more intuitive….

The rest of the guide was written without the use of full-time 16KEYS in mind

Select the Base

USER keyboard active.

16C = LN - referred to as 16C hereafter.

I'll use the alpha letter for the top-row keys to describe them for Base Selection

16C B = BINARY

16C C = OCTAL

16C D = DECIMAL

16C E = HEX

Enter a number

HEX

Enter HEX value 5F

Use the 16NPT function which lives on the A button

16C E (to get into HEX mode)

16C 16NPT 5 F ENTER

Convert to BIN

16C B gives 1011111

Enter a new BIN number

16C 16NPT (i.e. Alt) 1101100 ENTER

Add them together

16C + gives 11001011

Convert to HEX

16C E gives Cb

Convert to DEC

16C D gives 203

always enter numbers with 16C 16NPT the number ENTER

always use the 16 versions of mathematical functions

16C +

16C X

etc.

NOT, OR, AND, XOR

These are on shifted (and triggered with 16C) math keys:

- = NOT

+ = OR

x = AND

÷ = XOR

Example, in binary….

AND two numbers:

11011101 AND 10001001

16C B (to get into Binary mode if needed)

16C 16NPT 11011101 ENTER

16C 16NPT 10001001 ENTER

16C SHIFT X gives 10001001

In HEX…. XOR

16C E (to get into HEX)

16C 16NPT BEEF ENTER (first number) (make sure at least 16-bit word size for this example Word Size

16C 16NPT CAFE ENTER (second number)

16C SHIFT ÷ (XOR) gives 7411

Convert answer to DEC

16C D gives 29713

Convert answer to BIN

16C B gives a long string of 1 and 0 that scroll across the screen…

Window

View the long BIN number using a WINDOW to look at 8 bits at a time…

16C SHIFT R/S

This asks WINDOW _ and enter 0 for the 1st (MSB) 8 bits:

W0: 11101000:b

Scroll to sequential WINDOW slices with + and -

+

W1: 0010001:b

+

W2: :b

The full 16-bit number is therefore:

111010000010001

Setting Word Size and negative number convention

The word size can be up to 64 bits. In general most stuff is 4, 8 or 16 bits wide, so you can set the size of the binary number in the ∑MOD launcher:

16C USR (one of several different ways of getting to ∑MOD)

if 16KEYS keyboard is active then the quickest way is SHIFT 2 as the last method isn't available (no 16C assignment) 1)

There is then a choice of settings

B:O:D:H:F - 0: 1:2:W:S:?

The first four can set the mode to Binary, Octal, Decimal, Float.

  • 0 sets UNSIGNED integers
  • 1 sets ONE'S COMPLEMENT
  • 2 sets TWO'S COMPLEMENT

Word size is checked with S

Word size is set with W then enter (eg) 16 to set 16-bit words.

Word Size can also be set directly from a 16C keyboard function 16WSZ accessed via 16C SHIFT 5 rather than via the ∑MOD menu/launcher

? displays the current settings (press ? the quickly press again to hold the displayed info

0c - 16 - DEC

This means unsigned integers, 16-bit words, DECIMAL mode.

Other Launchers

Lots of functions are available in launcher sub-menus, eg a menu of rotate functions, or shift functions.

The various launchers are available cyclically via the 16C XEQ along with SHIFT and A

Some trial and error is needed to find what you want, but it starts:

16C XEQR: L LN RN R which is a menu to do bit-rotations.

Rotate 1-bit Left by pressing top-row button B

Rotate N-bits left with top-row button C (and enter the number of bits)

Rotate N-bits Right with top-row button D (and enter the number of bits)

Rotate 1-bit Right with top-row button E.

From the R menu:

A give the S: L LN RN R menu to SHIFT bits Left or Right

From the S menu:

XEQ gives ∑R : …………………. which gives lots of options to do things rightwards with the bits. FIXME list them

This goes on via XEQ and SHIFT (ORANGE button) to access several menu launchers. Trial and Error and muscle memory.

A brief map/list of launchers

assumes 16KEYS is active

XEQ∑ROT

∑ROTXEQ∑LEFTXEQ∑MODXEQ∑ROT

∑ROTA∑SHF

∑SHFXEQ∑RIGHTXEQ∑BITXEQ∑SHF

∑LEFTSHIFT∑RIGHT

∑MODSHIFT∑BIT

∑SHFSHIFTS“:

∑ROTSHIFTRC:

Registers etc

Numbers can be saved in 16C registers via 16C STO NN

e.g. save a subnet mask of 11111100 into REG 00 (a /30 network 255.255.255.252)

16C B (go to BINARY mode)

16C 16NPT 11111100 ENTER 16C STO 00

Use the stored value

What is 123 AND MASK ? (what's the network base number for host address of 123 using a netmask of 252?)

16C D (decimal so you can enter 123 rather than a BINARY number)

16C 16NPT 123 ENTER

recall mask (it doesn't matter that it was initially stored as a BINARY number, it's displayed in whatever base you are currently using)

16C RCL 00

AND them

16C SHIFT x

answer is 120

The MASK is still in 16-Register 00 if needed again….

Net address of a host with address 43?

16C D

16C 16NPT 43 ENTER

16C RCL 00

16C SHIFT X

answer : 40

xxx.xxx.xxx.43 has a network address of xxx.xxx.xxx.40

Most Used Functions

16C = LN (i.e. E on top-row)

16NPT = ∑+ (i.e. A on top-row, must be triggered with 16C) 2)

16C 16NPT type in a number ENTER (enter a number in whatever base is currently selected)

BIN OCT DEC HEX = 16C then one of top-row buttons B, C, D, E (select the required base)

∑MOD = 16C USR …. or 16C SHIFT 2 (open a settings menu to set the choice of mode/word/signed)

NOT / OR / AND / XOR = 16C SHIFT then one of - + x ÷ (logic functions)

RR / RL = 16C then one of SIN or COS (rotate Left or Right 1-bit)

RRN / RLN = 16C SHIFT then one of SIN or COS (rotate Left or Right N-bits)

SLN = 16C TAN (shift Left N-bits)

SRN = 16C SHIFT TAN (shift Right N-bits)

Sb = 16C SHIFT 7 (set a bit _ _)

Cb = 16C SHIFT 8 (clear a bit _ _)

B? = 16C SHIFT 9 (is a bit set or not?)

#BITS = 16C SHIFT ∑+ (i.e. A on top-row) (how many bits are high?)

See Keyboard Overlay Pic above for more hints on 16C key assignments

EVERYTHING STARTS WITH ''16C''

It is recommended to change the assigned key occasionally to prevent wearing it out…..

Page created Fri May 27 21:31:20 2022 by John Pumford-Green

Page last updated: 05/08/24 11:02 BST

1)
16C is still available on some keys…. e.g. SHIFT 6 = 16C so… SHIFT 6 USR∑MOD
2)
if you forget the 16C and hit ∑+ directly you'll probably end up with the complex number module keyboard triggger Z:
public/calculator/guides/hp16c_emulator.txt · Last modified: 05/08/24 11:02 BST by john