# HP-42S

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/HP-42S
> Markdown URL: https://mediated.wiki/source/HP-42S.md
> Source: https://en.wikipedia.org/wiki/HP-42S
> Source revision: 1328532034
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|Scientific calculator by Hewlett-Packard}}
{{Use dmy dates|date=April 2019|cs1-dates=y}}
{{ Infobox Calculator
| name         = HP-42S
| image        = HP42S.jpg
| caption      = HP-42S
| type         = [Programmable](/source/Programmable_calculator) [scientific](/source/Scientific_calculator)
| entry        = [RPN](/source/RPN_input_method)
| designfirm   =
| manufacturer = [Hewlett-Packard](/source/Hewlett-Packard)
| introduced   = 1988
| discontinued = 1995
| processor    = [Saturn](/source/HP_Saturn) ([Lewis](/source/HP_Lewis))
| precision    = 12 display digits (15 digits internally), exponent ±499
| display_type = [LCD](/source/Liquid_crystal_display) [dot-matrix](/source/dot-matrix)
| display_size = 2 lines, 22 characters, 131×16 pixels
| prog_lang    = [RPN](/source/Reverse_Polish_Notation) key stroke <small>(fully merged)</small>
| memory_step  = 7200
| memory_rom   = 64 [KB](/source/Kilobyte) of [ROM](/source/Read-only_memory)
| ports        = [IR](/source/Infrared) (Infrared) printing
| supply       = 3×1.5&nbsp;V button cell batteries (Panasonic LR44, Duracell PX76A/675A or Energizer 357/303)
| weight       = {{convert|6|oz|g|abbr=on}}
| dimensions   = 148×80×15&nbsp;mm
}}

The '''HP-42S RPN Scientific''' is a programmable [RPN](/source/Reverse_Polish_Notation) Scientific hand held calculator introduced by [Hewlett-Packard](/source/Hewlett-Packard) in 1988. It is a popular calculator designed for [science](/source/science) and [engineering](/source/engineering) students.

==Overview==
Perhaps the HP-42S was to be released as a replacement for the aging [HP-41](/source/HP-41) series as it is designed to be compatible with all programs written for the HP-41. Since it lacked expandability, and lacked any real [I/O](/source/Input%2Foutput) ability, both key features of the HP-41 series, it was marketed as an [HP-15C](/source/HP-15C) replacement.

The 42S, however, has a much smaller form factor than the 41, and features many more built-in functions, such as a [matrix](/source/Matrix_(mathematics)) editor, [complex number](/source/complex_number) support, an [equation solver](/source/equation_solver), user-defined menus, and basic graphing capabilities (the 42S can draw graphs only by programs). Additionally, it features a two-line dot matrix display, which made stack manipulation easier to understand.

Production of the 42S ended in 1995.<ref name="HPM_HP42S"/>

==Specifications==
thumb|HP-42S battery compartment and the IR diode
thumb|HP-42S calculator internal teardown

* Series: Pioneer
* Code Name: Davinci
* Introduction: 1988-10-31
* 64 [KB](/source/Kilobyte) of [ROM](/source/Read-only_memory)
* 8 [KB](/source/Kilobyte) of [RAM](/source/Random-access_memory)
* Functions: Over 350
* Expandability: Officially no other than [IR](/source/Infrared) printing (32&nbsp;KB memory upgrade<ref name="Hosoda_2007"/> and over-clocking hardware<ref>{{Citation |title=HP 42S Easy Double Speed / Turbo Mode for Calculator and Programs | date=14 February 2022 |url=https://www.youtube.com/watch?v=fYCjhFKgHdo |language=en |access-date=2022-08-05}}</ref> hacks are possible)
* Peripherals: [HP 82240A](/source/HP_82240A)<!-- while the HP 82240B is compatible as well, the manual only specifies the HP 82240A --> [infrared](/source/Infrared) printer

==Features==
*All basic scientific [functions](/source/Function_(mathematics)) (including [hyperbolic functions](/source/hyperbolic_functions))
*[Statistics](/source/Statistics) (including [curve fitting](/source/curve_fitting) and [forecasting](/source/forecasting))
*[Probability](/source/Probability) (including [factorial](/source/factorial), [random number](/source/random_number_generation)s and [Gamma function](/source/Gamma_function))
*[Equation solver](/source/Equation_solver) (root finder) that can solve for any variable in an equation
*[Numerical integration](/source/Numerical_integration) for calculating definite integrals
*[Matrix](/source/Matrix_(mathematics)) operations (including a matrix editor, [dot product](/source/dot_product), [cross product](/source/cross_product) and solver for simultaneous [linear equations](/source/linear_equations))
*[Complex numbers](/source/Complex_numbers) (including [polar coordinates](/source/polar_coordinates) representation)
*[Vector](/source/Vector_(mathematics_and_physics)) functions
*Named [variables](/source/Variable_(programming)), [registers](/source/Hardware_register) and binary flags
*[Graphic display](/source/Graphic_Display_Calculator) with graphics functions and adjustable contrast
*[Menus](/source/Menu_(computing)) with submenus and mode settings (also custom programmable) that use the bottom line of the display to label the top row of keys
*Sound ([piezoelectric beeper](/source/buzzer))
*Base conversion, integer arithmetic and binary and logic manipulation of numbers in [binary](/source/Binary_numeral_system), [octal](/source/octal), [decimal](/source/decimal) and [hexadecimal](/source/hexadecimal) systems
*Catalogs for reviewing and using items stored in memory
*Programmability (keystroke programming with [branching](/source/Branch_(computer_science)), [loops](/source/Control_flow), tests and flags)
*The ability to run programs written for the [HP-41C](/source/HP-41C) series of calculators

==Programming==
{{Main|Focal (HP-41)}}

The HP-42S is [keystroke-programmable](/source/keystroke_programmable), meaning that it can remember and later execute sequences of keystrokes to solve particular problems of interest to the user. The HP-42S uses a superset of the [HP-41CX](/source/HP-41CX) [FOCAL](/source/HP_FOCAL) language.

All programs are stored in one continuous program space, and may be created and edited by switching to programming mode, using the {{keypress|PRGM}} key.
Subroutines are enclosed in {{keypress|LBL}}/Label (name of subroutine) and {{keypress|RTN}}/Return (halts execution unless it is in a subroutine in which case it returns to the caller). Keystrokes (of functions) are enclosed between {{keypress|LBL}} and {{keypress|RTN}} or {{keypress|.END}}.

In a running program, a {{keypress|GTO}} ''label'' causes program execution to branch to the specified label and continue running at that line. Executing a GTO instruction from the keyboard moves the program pointer to the corresponding label. No program lines are executed.

{{keypress|XEQ}} is used in much the same way with one important difference: after an {{keypress|XEQ}} instruction has transferred execution to the specified label, the next RTN (return) or END instruction causes the program to branch back to the instruction that immediately follows the XEQ instruction. Programs/Subroutines can also be executed with the help {{keypress|XEQ}} ''label'' (Execute) key.
The important difference between the {{keypress|XEQ}} and {{keypress|GTO}} is that {{keypress|XEQ}} executes the label and returns to previous subroutine and continues execution from the line following {{keypress|XEQ}},whereas {{keypress|GTO}} branches to the label specified and doesn't return.

{{keypress|GTO}}{{keypress|.}}{{keypress|.}} packs the current subroutines and moves to new program space.{{keypress|GTO}}{{keypress|.}}''nnnn'' can be used to reach a particular line of program.

=== Programming examples===
A simple program to calculate area of circle
{| class=wikitable
! Step
! Instruction
! Comment
|-
|00
| { 6-Byte Prgm }
|-
| 01
| {{keypress|LBL}}{{keypress|A}}{{keypress|R}}{{keypress|E}}{{keypress|A}}
| Start of program "AREA"
|-

| 02
| {{keypress|INPUT}}{{keypress|R}}
| Prompts for Value of R and stores it in R
|-
| 03
| {{keypress|X↑2}}
| Squares the value in X register
|-
| 04
| {{keypress|PI}}
| Puts π on the stack
|-
| 05
| {{keypress|×}}
| Multiplies values in X and Y register
|-

| {{keypress|END}} or {{keypress|RTN}}
| Returns control (and result in X) to either the user or to a calling program.
|}

Program instructions like {{keypress|STOP}}, {{keypress|PROMPT}}, {{keypress|INPUT}} halt the program execution,which can be continued by pressing {{keypress|R/S}}.

{{keypress|VIEW}} is used to view contents of a register,For example R in the above example.

=== Using Integral and Equation Solver ===
It is necessary to write a program or subroutine that evaluates f(x) for the function which needs to be solved or integrated.
Variables used in program should be declared using {{keypress|MVAR}}

Here is a sample program to solve the equation °F = (9/5×°C) + 32

{| class=wikitable
! Step
! Instruction
! Comment
|-
|00
| { 31-Byte Prgm }
|-
| 01
| {{keypress|LBL}}{{keypress|T}}{{keypress|E}}{{keypress|M}}{{keypress|P}}
| Start of program "TEMP"
|-
| 02
| {{keypress|MVAR}}{{keypress|F}}
| Declares F as a variable for solver
|-
| 03
| {{keypress|MVAR}}{{keypress|C}}
| Declares C as a variable for solver
|-
| 04
| {{keypress|RCL}}{{keypress|F}}
| Recall F
|-
| 05
| {{keypress|9}}
| 
|-
| 06
| {{keypress|5}}
| 
|-
| 07
| {{keypress|÷}}
|-
| 08
| {{keypress|RCL}}{{keypress|C}}
| Recall C
|-
| 09
| {{keypress|×}}
| 
|-
| 10
| {{keypress|-}}
|-
| 11
| {{keypress|3}}{{keypress|2}}
|-
| 12
| {{keypress|-}}
|-
| {{keypress|END}} or {{keypress|RTN}}
| Returns control (and result in X) to either the user or to a calling program.
|}
After, accessing the solver using {{button|Shift}} {{keypress|7}} ({{keypress|SOLVER}} ), select program {{keypress|TEMP}}.

In a similar way, expressions can be integrated. After selecting the variable of integration, enter the lower limit and then press on {{keypress|LLIM}}, similarly input {{keypress|ULIM}} (upper limit) and {{keypress|ACC}} (accuracy).

==Emulators==
thumb|Emu 42
HP 42s can be accessed through Android Emulators like '''Emu42''' and '''Free42'''.
200px|thumb|WP 34s

==Reference Books==
'''Guides and Collections of Keystroke Programs'''

Documentation for the HP 42S calculator at hpcalc.org<ref>{{cite web | title=All Known HP Calculator Literature | url=https://literature.hpcalc.org/all }}</ref><ref>{{cite web | title=All Known HP Calculator Literature | url=https://literature.hpcalc.org/all#model:42S }}</ref>
*HP-42S Owner's Manual <ref>{{cite web | title=HP-42S Owner's Manual - HP Calculator Literature | url=https://literature.hpcalc.org/items/929 }}</ref>
*HP-42S Programming Examples & Techniques<ref>{{cite web | title=HP-42S Programming Examples & Techniques - HP Calculator Literature | url=https://literature.hpcalc.org/items/934 }}</ref>
*Step-by-Step Solutions: Electrical Engineering (42S)<ref>{{cite web | title=Step-by-Step Solutions: Electrical Engineering (42S) - HP Calculator Literature | url=https://literature.hpcalc.org/items/924 }}</ref>
*Step-by-Step Solutions: Mechanical Engineering (42S)<ref>{{cite web | title=Step-by-Step Solutions: Mechanical Engineering (42S) - HP Calculator Literature | url=https://literature.hpcalc.org/items/927 }}</ref>
*Advanced Circuit Analysis with the HP-42S<ref>{{cite web | title=Advanced Circuit Analysis with the HP-42S - HP Calculator Literature | url=https://literature.hpcalc.org/items/1449 }}</ref>
*An Easy Course in Using the HP-42S<ref>{{cite web | title=An Easy Course in Using the HP-42S - HP Calculator Literature | url=https://literature.hpcalc.org/items/1459 }}</ref>

'''Educational Texts on RPN calculators'''

*Algorithms for RPN Calculators<ref>{{cite web | title=Algorithms for RPN Calculators - HP Calculator Literature | url=https://literature.hpcalc.org/items/1454 }}</ref>
*Scientific Analysis on the Pocket Calculator<ref>{{cite web | title=Scientific Analysis on the Pocket Calculator - HP Calculator Literature | url=https://literature.hpcalc.org/items/1712 }}</ref>
*Engineering Statistics with a Programmable Calculator<ref>{{cite web | title=Engineering Statistics with a Programmable Calculator - HP Calculator Literature | url=https://literature.hpcalc.org/items/1533 }}</ref>
*Applied Mathematical Physics with Programmable Pocket Calculators<ref>{{cite web | title=Applied Mathematical Physics with Programmable Pocket Calculators - HP Calculator Literature | url=https://literature.hpcalc.org/items/1479 }}</ref>
*Mathematical Astronomy with a Pocket Calculator<ref>{{cite web | title=Mathematical Astronomy with a Pocket Calculator - HP Calculator Literature | url=https://literature.hpcalc.org/items/1663 }}</ref>
*Handbook of Electronic Design and Analysis Procedures using Programmable Calculators<ref>{{cite web | title=Handbook of Electronic Design and Analysis Procedures using Programmable Calculators - HP Calculator Literature | url=https://literature.hpcalc.org/items/1558 }}</ref>
*Calculator Programs for Chemical Engineers(Vol 1 & 2)<ref>{{cite web | title=Calculator Programs for Chemical Engineers - HP Calculator Literature | url=https://literature.hpcalc.org/items/1536 }}</ref><ref>{{cite web | title=Calculator Programs for Chemical Engineers Vol. 2 - HP Calculator Literature | url=https://literature.hpcalc.org/items/1860 }}</ref>

'''Collection of Algorithms/Keystroke Programs for HP 41/HP 42S'''

*Software Library for HP 41 Programs(Compatible with HP 42S)<ref>{{cite web | title=MoHPC HP-41C Software Library | url=https://www.hpmuseum.org/software/soft41.htm }}</ref>

==See also==
* [FOCAL character set](/source/FOCAL_character_set)
* [Comparison of HP graphing calculators](/source/Comparison_of_HP_graphing_calculators)
* [HP calculators](/source/HP_calculators)
* [List of Hewlett-Packard pocket calculators](/source/List_of_Hewlett-Packard_products)
* [NOMAS (support)](/source/NOMAS_(support))

==References==
<references>

<ref name="HPM_HP42S">{{cite web |title=HP-42S |url=http://www.hpmuseum.org/hp42s.htm |website=Museum of HP Calculators |access-date=2016-10-27}}</ref>
<ref name="Hosoda_2007">{{cite web |author-first=Takayuki |author-last=Hosoda |title=Upgrading the memory of the HP 42S to 32KB |date=2007-10-10 |url=http://www.finetune.co.jp/~lyuka/interests/calc/hp42s/ |access-date=2011-08-12 |url-status=live |archive-url=https://web.archive.org/web/20170917220206/http://www.finetune.co.jp/~lyuka/interests/calc/hp42s/ |archive-date=2017-09-17}}</ref>

</references>

==Further reading==
* {{cite book |title=HP-42S RPN Scientific Calculator – Owner's Manual |date=June 1988 |location=Corvallis, OR, USA |publisher=[Hewlett-Packard Co.](/source/Hewlett-Packard_Co.) |edition=1 |id=00042-90001 |url=http://www.hp41.net/forum/fileshp41net/manuel-hp42s-us.pdf |access-date=2017-09-17 |url-status=live |archive-url=https://web.archive.org/web/20170917215457/http://www.hp41.net/forum/fileshp41net/manuel-hp42s-us.pdf |archive-date=2017-09-17}}
* {{cite book |title=HP-42S RPN Scientific Calculator – Programming Examples and Techniques |date=July 1988 |publisher=[Hewlett-Packard](/source/Hewlett-Packard) |edition=1 |id=00042-90020, 00042-90019 |url=http://www.hp41.net/forum/fileshp41net/hp42s-programming-examples.pdf |access-date=2017-12-19 |url-status=live |archive-url=https://web.archive.org/web/20171219223759/http://www.hp41.net/forum/fileshp41net/hp42s-programming-examples.pdf |archive-date=2017-12-19}}
* {{cite book |title=An Alternative HP-42S/Free42 Manual |author-first1=José Lauro |author-last1=Strapasson |author-first2=Russ |author-last2=Jones |date=January 2010 |version=0.7 |url=http://thomasokken.com/free42/42s.pdf |access-date=2017-09-17 |url-status=live |archive-url=https://web.archive.org/web/20170917215145/http://thomasokken.com/free42/42s.pdf |archive-date=2017-09-17}}
* HP-42S Quick Reference Guide (1 ed.). Corvallis, OR, USA, Dex Smith. October 1988. 00042-92222E.
*{{cite web |title=HP-42S Owner's Manual Addendum: Hidden Matrix Functions |author-first=Joseph K. |author-last=Horn |date=2017-08-23 |orig-date=1988-11-09 |url=http://www.hpmuseum.org/forum/thread-8887-post-77713.html#pid77713 |access-date=2017-09-17 |url-status=live |archive-url=https://web.archive.org/web/20170917214206/http://www.hpmuseum.org/forum/thread-8887-post-77713.html |archive-date=2017-09-17}}
* {{cite web |title=DM42 User Manual |version=3.17 |publisher=[SwissMicros GmbH](/source/SwissMicros_GmbH) |date=2020-10-21 |orig-date=2016 |url=https://www.swissmicros.com/dm42/doc/dm42_user_manual/ |access-date=2020-10-21 |url-status=live |archive-url=https://web.archive.org/web/20201005101350/https://technical.swissmicros.com/dm42/doc/dm42_user_manual/ |archive-date=2020-10-05}}

==External links==
* [https://www.swissmicros.com/product/dm42 SwissMicros DM42]
* [http://www.hpcc.org/datafile/V23N6/LongLiveTheHP42S.pdf HP-42S intro on hpcc.org]
* [http://www.hpmuseum.org/hp42s.htm HP-42S page on hpmuseum.org]
* [https://web.archive.org/web/20141217101848/http://www.hp42s.com/ HP-42S resources on hp42s.com] (defunct as of July 2017)
* [http://www.rskey.org/detail.asp?manufacturer=Hewlett-Packard&model=HP-42S HP-42S description on rskey.org]
* [http://www.thimet.de/CalcCollection/Calculators/HP-42S/Contents.htm HP-42S description on thimet.de]
* [https://market.android.com/details?id=com.thomasokken.free42&feature=also_installed#?t=W251bGwsMSwxLDEwNCwiY29tLnRob21hc29ra2VuLmZyZWU0MiJd Free42 for Android by Thomas Okken, an Open Source project.]
* {{cite web |url=http://thomasokken.com/free42 |title=Free42, A HP-42S Calculator Simulator |author-first=Thomas |author-last=Okken |date=2011-04-20 |access-date=2011-08-12}}

{{HP calculators}}

42S
42S
42S
Category:Computer-related introductions in 1988

---
Adapted from the Wikipedia article [HP-42S](https://en.wikipedia.org/wiki/HP-42S) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/HP-42S?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
