Sunday, January 10, 2016

HP 15C: Binary to Decimal Conversion

HP 15C:  Binary to Decimal Conversion

Input:  A number in binary form.  Maximum value: 1 111 111 111 (1,023 in decimal).  

Registers used:

R0 = number in binary
R1 = number in decimal
R2 = counter

I have this program under label C.

Program:

Step
Key
Key Code
001
LBL C
42, 21, 13
002
STO 0
44, 0
003
LOG
43, 13
004
INT
43, 44
005
1
1
006
+
40
007
3
3
008
10^X
13
009
÷
10
010
STO 2
44, 2
011
0
0
012
STO 1
44, 1
013
LBL 3
42, 21, 3
014
RCL 0
45, 0
015
RCL 2
45, 2
016
INT
43, 44
017
1
1
018
+
40
019
10^X
13
020
÷
10
021
FRAC
42, 44
022
1
1
023
0
0
024
*
20
025
INT
43, 44
026
2
2
027
ENTER
36
028
RCL 2
45, 2
029
INT
43, 44
030
Y^X
14
031
*
20
032
STO+ 1
44, 40, 1
033
ISG 2
42, 6, 2
034
GTO 3
22, 3
035
RCL 1
45, 1

(Line 006 was corrected, the key code should be 40, not 10.  Much thanks and appreciation to Torben Fuglsang  for pointing this out to me.)  

Examples:

Binary: 1101, Decimal: 13

Binary: 10101, Decimal: 42


This blog is property of Edward Shore.  2016

No comments:

Post a Comment

Adventures in Python: String Manipulation and Function/Derivative Table (Subroutines)

Adventures in Python:  String Manipulation and Function/Derivative Table (Subroutines) String Manipulation This script demonstrate...