# IVEE - a Powerful Programable RPN Calculator based on FORTH
Version 1.0, (c) 2020 by deetee/zooxo
This software is covered by the 3-clause BSD license.
____________________
![all](https://user-images.githubusercontent.com/16148023/94920040-ca074d80-04b5-11eb-8cec-c0d62ee9ae49.jpg)
See a short video of IVEE at: https://youtu.be/m1aFRhqvuLM
____________________
PREAMBLE
____________________
Ivee is a powerful programable RPN calculator based on the programming
language FORTH. This innovative and powerful machine benefits of a brilliant
symbiosis, as both - the RPN calculator and FORTH - are stack based systems.
The name Ivee or IV stands for the roman number 4, which was also a basis for
naming Forth (4th generation of programming languages).
Ivee complements a viable set of Forth words (26 commands) with a set of
system oriented commands and additional built-in Forth words. In addition
the user can define/program new words based on existing words and commands.
The hardware is simple:
- Arduino Pro Micro
- OLED display (128x64 pixel) with SSD1306- or SSD1309-controller
- 16 keys (push buttons)
optional: - LIPO battery
- LIPO battery charger (TP4056)
- ON/OFF-switch
Allthough Ivee is operated by 16 keys only it offers a wide range of functions
and possibilities:
- 120 intrinsic functions based on FORTH
- Programming: Handle up to 40 user definable programs
(Edit, New, Rename, Move, Delete, Send, Load)
- Dictionary of all commands, words and programs
- Fast user definable menu (longpressed F-key)
- Calculations with complex numbers for nearly every function
- Calculus (f(x), plot, solve, integrate)
- Basic math operations in number systems with selectable BASE
- Business calculator mode (accuracy of 18 digits)
- Save up to 10 numbers/constants permanently
- Statistics and line best fit
- Many unit conversions
- Clock and Torch function
- Basic system functions (Battery voltage, Brightness, Screensaver)
Have fun!
deetee
____________________
KEYBOARD, SHORTCUTS
____________________
F(G)[OFF]{MENU} 7(S+)[SCLR] 8(PRG)[BASE] 9(/)[MOD]
E(SWAP)[ROT] 4(DICT)[USR] 5(FX)[FPLOT] 6(*)[LIT]
N(OVER)[PICK] 1(RCL)[STO] 2(SOLVE)[FINT] 3(-)[LIT-]
X(CLR)[TOFF] 0(CPLX)[BATT] .(R<>P)[CLK] #(+)[LIT+]
PRG Shortcuts: BASE/HEX Shortcuts:
5 OUT 6 UP 4 E 5 F
1 NEW 2 IN 3 DOWN 1 B 2 C 3 D
0 REN . DEL D EDIT 0 A . A~F
MENU/DICT/REN Navigation: SUM/STAT/L.R. Storage Registers:
Q1 Q2 Q3 Q4 7 SN 8 SX 9 SY
UP E 4 5 6 5 SXX 6 SXY
DOWN N 1 2 3
PREV0 .NEXT
____________________
DISPLAY, INDICATORS
____________________
> ... Empty stack, ready to calculate
> ... Indicates selected program in program selection mode
< ... Indicates selected program step in program editing mode
a~z ... Stack level
_ ... Indicates number input
i, angle ... Imaginary part, imaginary angle
B ... BASE mode indicator
n BASE ... Numeric base of BASE mode
! ... Indicates float of data stack (data loss in lowest stack level)
^, v ... F-key, G-key
____________________
LIMITS
____________________
As a microprocessor is primarily not made to do such complex things like
performing a powerful calculator there are some limits in performance and
resources.
Most obviously is the limited precision of the intrinsic float format (IEEE
754, 32 bit). As four bytes only are used to represent a float respective
double number the decimal digits of precision is limited to 6...7. For
example calculating sqrt(-1) yields in a display of "7.5E-8 + i" (instead of
"0 + i").
In addition the resources of a microcontroller are limited like the FLASH
memory (holds the executable program code), the RAM memory (holds variables
and data while running) and the EEPROM (holds permanent data like settings or
user programs).
However Ivee tries to offer a maximum of features, comfort and performance
with a minimum of required resources.
LIMITS:
```
26 ... Maximal data stack size (a...z)
7 ... Maximum number of displayed significant digits of a number
36 ... Maximum number of decimal exponent digits (1E-37 < X < 1E37)
12 ... Maximal size of text display (see EMIT, CTX)
10 ... Maximal amount of (complex) numbers saved permanently (0...9)
3 ... Maximal number of characters for naming an user program
40 ... Maximal number of user programs
128 ... Maximal size of an user program (steps)
900 ... Maximal size (steps) of all user programs
64 ... Maximal size of address stack ("deep of nesting")
1E-4 ... X-range of solver (Newton) to determine slope of function
10 ... Calculation "stripes" for integrating (Simpson)
32 ... Maximal definable command slots of user menu
```
____________________
BROWSING MENUS
____________________
To navigate through the menu of some functions (MENU, DICT, USR, renamePRG)
all selectable items are divided into four sections. Every section has its
own up and down key (section I: E/N, section II: 4/1, section III: 5/2 and
section IV: 6/3).
To move to the previous or next entry (regardless which section is selected)
the keys "0" or "." can be used. To select one of the four presented items
use the appropriate function key (F/7/8/9) or escape the menu with "X".
____________________
PROGRAMMING
____________________
Ivee is able to deal with up to 40 user programs with a total number of
900 steps/commands. To deal with programs enter the program selector mode
with PRG.
While in the program selection mode on the left side of the display the
available programs are numbered and listed. On the right side of the display
the number of programs, the memory used and the memory available are shown.
To navigate between programs use the cursor keys E (up) and N (down).
Edit a selected program with # or press 1 to enter a new program.
To delete a program press "." - to rename it use the key 0.
You can move a program with 6 up or with 3 down. Note that the top program
has special calculus features (f(x), plot, solve, integrate).
To send a program (does not include the program name) via USB to another
computer press "5". Note that corresponding ascii characters will be sent
(see chapter DICTIONARY, second column). In a similar way programs can be
send from another computer to Ivee (press key 2) and will be stored as new
program.
With the 3 powerful commands @, ! and EXE (see chapter DICTIONARY) it is
even possible to manipulate the program memory and execute code.
A program is structured into the three parts NAME, COMMANDS and EOP-marker.
Please note that the length of the program name is restricted to 3
characters and the maximum number of program steps is restricted to 128.
____________________
BASE, BUSINESS MODE
____________________
To calculate with integer values with other numeric base enter the base and
select the BASE command (ie 16 BASE to calculate with hexadecimal numbers).
To return to the scientific mode press BASE again. When changing the mode
the whole stack will be converted (as far as appropriate) to the new base.
Numbers will be displayed in groups of four digits in two lines with a
B-indicator (BASE) on the left side and the base itself on the right side of
the first line. Pressing "E" enters four zeros.
Note that only basic operations (/*-+) and some stack operations are
supported. To enter digits bigger than 9 (ie F) press "." followed by a key
(ie 5 to enter F).
The BASE state will be stored permanently.
Entering the BASE mode with 10 activates the business mode to deal with big
numbers and high accuracy, like trillions of dollars with cent accuracy.
Numbers are grouped into triples and two digits after the decimal dot
(cents) are supported.
____________________
CALCULUS
____________________
Ivee is able to analyze the first user defined program. Note that you can
move the desired user program to the first position using the keys 6 or 3
in program mode (PRG).
To calculate the value of a function use F(X).
To find the root of a function enter a start value (X) and press FSOLVE.
Enter the x-range (from Y to X) before plotting a function (FPLOT) or
calculating an integral (FINT).
____________________
COMMANDS
____________________
```
MEMORY
functions mem[] EEPROM
|<--intrinsic-->|<--builtin-->|<--user-->|
0 76 120 160
MAXCMDI^ MAXCMDB^ MAXCMDU^
OVERVIEW
Intrinsic
Forth DUP DROP NEGATE / * - + MOD DICT SWAP ROT PICK
< = <> > KEY EMIT BASE BEGIN UNTIL IF ELSE THEN @ !
System 0~9 . E STO RCL CLR USR NAND INTEGER PI INV SIN EXP LN
COMPLEX REC<>POL F(X) FPLOT FSOLVE FINTEGRATE
PRG T+ PSE EXE BREAK CLRTEXT ISREAL
SUM+ SUM- SUMCLR COMB PERM STAT LR
BATT LIT LIT+ LIT- CLOCK OFF TOFF
Builtin
Forth OVER HEX AND NOT OR ABS
Other $ SQRT POWER POWER10 LOG LN! PV ND QE HMS>H H>HMS CLOCK
COS TAN ASIN ACOS ATAN SINH COSH TANH ASINH ACOSH ATANH
DEG>RAD RAD>DEG C>F F>C KM>MI MI>KM M>FT FT>M CM>IN IN>CM
DICTIONARY (in order of "appearence")
000 0 ... Numbers
001 ! 1
002 " 2
003 # 3
004 $ 4
005 % 5
006 & 6
007 ' 7
008 ( 8
009 ) 9
010 * . ... Dot key
011 + DUP ... Duplicate, end number input
012 , DROP ... Drop X, clear entry
013 - N ... NEG, change sign (negate X)
014 . E ... Enter 10th exponent (actually Y*10^X)
015 / F ... Function key (Shift)
016 0 CPLX ... Enter complex number and vice versa (see R<>P)
017 1 RCL ... Recall memory (number = X) from permanent memory. Note that
the memories 5...9 are used as statistic registers.
018 2 FSOLV ... Find the root of the first user defined program/function
(PRG) using X as start value
019 3 - ... Substract (X = Y-X)
020 4 DICT ... Catalog all functions (see section BROWSING MENUS)
021 5 F(X) ... Calculate first user defined program/function (PRG)
022 6 * ... Multiply (X = Y*X)
023 7 S+ ... Add values of X- and Y-register to sums (see STAT/LR)
024 8 PRG ... Enter program mode (see section PROGRAMMING)
025 9 / ... Divide (X = Y/X)
026 : R<>P ... Toggle rectangular or polar mode (see CPLX)
027 ; + ... Addition (X = Y+X)
028 < CLR ... Clear stack and alpha register
029 = OVER ... Push/copy Y to stack (YX -> YXY)
030 > SWAP ... Swap last two stack contents (XY -> XY)
031 ? G ... Second function key (Shift-Shift)
032 @ BATT ... Show battery voltage (push to stack)
033 A STO ... Store Y memory (number = X). Note that the memories 5...9
are used as statistic registers (Sxx, Sxy, n, Sx, Sy).
034 B FINT ... Integrate the first user defined program (PRG) using
the x-range from Y to X
035 C B- ... Lower the brightness of the display (5 levels). Note that
the display has to be rebooted (needs two seconds).
036 D USR ... Set function key of (custom) user MENU
037 E FPLOT ... Plot the first user defined program (PRG) using the the
x-range from Y to X. Escape with key "X".
038 F LIT ... Illuminate the whole display
039 G SCLR ... Clear all sum register. Note that statistic functions are
using the permanent memories 5...9.
040 H BASE ... Set number base for integer calculations (i.e. 2, 8, 16).
Note that setting the base to 10 enters the business
calculator mode (see chapter BASE, BUSINESS MODE).
041 I MOD ... Modulo, division remainder (X = Y%X)
042 J CLOCK ... Simple clock. To set the time use hh.mmss.
043 K LIT+ ... Rise the brightness of the display (5 levels). Note that
the display has to be rebooted (needs two seconds).
044 L TOFF ... Set the screen off time (x 10 s) (>=3)
045 M PICK ... Copy n-th number of stack to stack
046 N ROT ... Rotate 3 numbers of stack (ZYX -> YXZ)
047 O DARK ... Enter screen off manually (triple press F)
048 P < ... Condition less than (returns true, if Y
... Condition not equal (returns true, if Y<>X)
051 S GT ... Condition greater than (returns true, if Y>X)
052 T NAND ... Logical NAND (used for other logical functions)
053 U T+ ... Adds duration in ms to stack (since last call)
054 V PSE ... Pause program execution for X*250 ms and print screen
055 W INT ... Calculate integer value of X
056 X @ ... Fetch the value from address (X) (see also ! and EXE)
057 Y ! ... Store Y at X-address (see also @ and EXE)
058 Z BEGIN ... Begin a BEGIN-UNTIL-Loop
059 [ UNTIL ... Continue executing a BEGIN-UNTIL-Loop until X is true
060 \ EXE ... Execute code at X-address (see also @ and !)
061 ] IF ... Execute the following code if true
062 ^ ELSE ... Execute the following code if IF failed
063 _ THEN ... Terminate an IF(-ELSE) condition
064 ` BREAK ... Pause code execution for input (key "X" resumes)
065 a KEY ... Wait for keypress and push the keycode to stack
066 b CTX ... Clear text area (written with EMIT)
067 c EMIT ... Emit ascii character of X
068 d RE? ... Return true, if X is a real value
069 e nCr ... Calculate the combination (of yCx)
070 f nPr ... Calculate the permutation (of yPx)
071 g PI ... Push the value of PI to stack
072 h INV ... Push the reciprocal value of X to stack
073 i SIN ... Push the sine of X to stack
074 j EXP ... Push the exponential value of X to stack
075 k LN ... Push the natural logarithm of X to stack
076 l $ ... Activate the business calculator mode (10 BASE)
077 m HEX ... Activate HEX mode (16 BASE)
078 n AND ... Logical AND
079 o NOT ... Logical NOT
080 p OR ... Logical OR
081 q OVER ... Push/copy Y to stack (YX -> YXY)
082 r ABS ... Push the absolute value of X to stack
083 s SQRT ... Push the quare root of X to stack
084 t COS ... Push the cosine of X to stack
085 u TAN ... Push the tangent of X to stack
086 v POW ... Push Y raised to the power of X to stack (X = Y^X)
087 w 10^ ... Push 10 raised to the power of X to stack (X = 10^X)
088 x LOG ... Push the 10 based logarithm of X to stack
089 y ASIN ... Push the arcus (inverse) sinus of X to stack
090 z ACOS ... Push the arcus (inverse) cosine of X to stack
091 { ATAN ... Push the arcus (inverse) tangent of X to stack
092 | SINH ... Push the hyperbolic sine of X to stack
093 } COSH ... Push the hyperbolic cosine of X to stack
094 ~ TANH ... Push the hyperbolic tangent of X to stack
095 ? ASINH ... Push the area (inverse) hyperbolic sine of X to stack
096 ? ACOSH ... Push the area (inverse) hyperbolic cosine of X to stack
097 ? ATANH ... Push the area (inverse) hyperbolic tangent of X to stack
098 ? LN! ... Push the natural logarithm of gamma of X to stack
099 ? >h ... Convert hh.mmss to h (HMS->H)
100 ? h> ... Convert h to hh.mmss (H->HMS)
101 ? PV ... Present value of given interest rate and periods
102 ? ND ... PDF (X) and CDF (Y) of standard normal distribution
103 ? QE ... Quadratic equation xx+Yx+X=0 X|Y=-Y/2+-sqrt(Y*Y/4-X)
104 ? CLOCK ... Simple clock (set with hh.mmss)
105 ? SCLR ... Clear statistic registers (permanent memories 5...9)
106 ? S+ ... Add values of X- and Y-register to sums (see STAT/LR)
107 ? S- ... Substract values of X- and Y-register to sums (see STAT/LR)
108 ? STAT ... Mean value (X) and standard deviation (Y). Note that the
permanent memories 5...9 (see RCL/STO) are used as statistic
registers (Sxx, Sxy, n, Sx, Sy).
109 ? LR ... Line best fit (y = X * x + Y)
110 ? % ... Percent (X/Y*100%)
111 ? %CHG ... Percent change (X-Y)/Y*100%
112 ? FRAC ... Fractional part
113 ? >|
| ^ | | sizeof(mem) +
0|1 mp | | sou=sizeofusr()
v |_ _ _ _ _ _ _ _ _ _ v _ _ _ _ _ _ _ _
EEPROM[] |_|_|_|_ _ _ _ _|_|_|_|_|_|_|_|_|_|_|_|
|<---user-programs--->|<-- @ ! EXE -->|
|^EEUSTART EEUEND^|
|<------- sou ------->| |
|<------------ 901 bytes ------------>|
DATASTACK ADDRESSSTACK CONDITIONAL
(2 x double, int64) (int) POINTER
| | | | | |
|______|______|_______| |_____|
近期下载者:
相关文件:
收藏者: