TI59R revival - upgrade of TI-59 calculator
>>> UNTESTED <<<
Upgrade of TI-59
calculator with ATmega644P processor.
Accuracy of calculations to 19 valid digits, exponent 4 digits.
EDIT: Continuing the development is the ET-58 calculator.
The TI59R is the next intermediate step in the development of the calculator, following on from the previous calculator TI58T. It is again a development intermediate, so the hardware aspect is not solved (I am solving the software), I even used the box from the previous TI58T including the unsightly printing ;-) The aim was to mimic the function of the original TI-59 as much as possible and to extend its functions without affecting the original functionality. The development of this prototype is roughly complete, the planned functionality is implemented, but the calculator has not been thoroughly tested and some features may be incorrect. Thorough testing is not expected until the final version of the calculator. After that, I plan to fine-tune the intermediate prototypes so that they can be used as lightweight functional calculators. I plan to come back to this project later. I am also continuing with the prototype with the STM32 processor as the next intermediate step.
This prototype uses an ATmega644P processor with 64 KB of ROM (the software uses 50 KB of ROM, the rest of the ROM is used to store the library module). The 2 KB EEPROM is used half for the user program (1000 steps), the other half is used to store either the user program or the user registers (using the Write function). The 4 KB RAM is used 1 KB for the user registers (100 registers, each register 10 bytes), 3/4 KB for the disk buffers, and part of the RAM is used for constants. The remaining about 700 bytes of RAM is planned to be used for a screen generator (printer output to a TV or monitor), but this function has not yet been implemented.
The calculator has been programmed in C (WinAVR). The same code is used in the emulator and will be used in the final version of the calculator, so the source code can no longer be made publicly available, but only as a compiled binary file (firmware).
Note: Click to enlarge some of the images here
Properties:
In contrast to the original calculator, much higher accuracy and exponent range has been achieved (the original calculator calculates to 13 valid digits with an exponent of 2 digits). Some functions have been improved - e.g. the '=' button repeats the last arithmetic operation. The program is stored in the EEPROM (1000 bytes) and so is retained even after the power is turned off. The RAM (4 KB) is used partly for user memory cells. The memory cells do not share space with the program memory and therefore there is no need to change the allocation between them (everything is always accessible). Each memory cell has 10 bytes, of which 8 bytes are signed mantissa and 2 bytes are exponent with bias 0x8000. The display can easily be swapped out for either blue or green.
The calculator is also available as an emulator (uses the same firmware):
Display:
The display is two rows. The lower row is used for calculation and programming, the upper row is used to indicate switches and to display adjacent memory steps during programming. Displayed switches: Deg/Rad/Grd angular measure (Deg is not displayed), DEC/HEX/OCT/BIN number system (DEC is not displayed), Fx fixed decimal places 0..8 (9 off is not displayed), Eng/EE exponential mode (Eng technical mode where the exponent is a multiple of 3), 2n/3r function switch, Inv inverse operations. The last position of the 1st line displays the currently executed arithmetic operation.
Diagram:
The USB connector is only used to power the +5V calculator. The output is to the 2-line LCD display. In this version, no battery is included, so the display uses a backlight. The SD card is connected via resistors serving as a converter between the +5V and +3.3V levels. Support for mono output to TV via cinch connector is provided (VIDEO and SYN signals), video output has not yet been implemented by software.
Construction:
To simplify the design as much as possible, micro switches without a fingerboard were used as buttons, only protruding above the calculator surface. The display connects via a pin rail to allow easy access to the board. This allows for easy replacement of the display - both blue and green LCDs were tested. The board connection is just a single-sided connection, with a few wire jumpers. The size of the PCB is subject to the size limitations of the Eagle Free and the 10x7.5 cm PCB used.
bottom side:
top side (wire jumpers are sufficient):
mounting:
prints:
labels under the buttons - the emulator keyboard can be used:
mounted PCB:
The board is screwed to the bottom of the box:
the display is connected to the board with a connector and fixed with a spacer:
The following description applies to both the real calculator and the emulator. For the emulator, the current folder is used instead of the SD card. Therefore, the emulator must be used in a folder to which write permissions will be enabled.
When the calculator is switched on (after the emulator is started), a library module named MODULE.LIB is loaded into memory. There are 9 original library modules available in the folder. Renaming (copying) one of them to the name MODULE.LIB will ensure that it is loaded into memory. The modules are in binary format, created by converting the library files from text format using the TI59_module conversion program.
Printing is also done to the SD card (to the emulator folder) - to a file named PRINT.TXT. Programs are saved to files 1.LIB to 9.LIB using the Write command.
The following list of buttons shows the HEX code used in the program and the symbol on the calculator. The alternative button functions (listed above the button) are invoked when the 2nd button is pressed. The calculator also has a second set of alternative functions, marked in red on the keyboard, which are called when the 2nd button is pressed twice. Many of the functions also have an inverse function that is activated when the INV button is pressed. The INV button must always be pressed before pressing the 2nd button (the reverse procedure activates the alternate functions of the INV button). On the emulator keyboard, the key codes to invoke the button from the PC keyboard are shown in green.
If an error occurs during a calculation or program run, the calculator indicates it by flashing the display. The 'E' sign indicates a "soft" error, after which the calculation can continue - e.g. division by zero. The switch setting (StFlg) number 8 determines whether the calculator stops after a soft error occurs. With the default setting (switch off), the calculator does not stop. The character 'F' indicates a 'hard' error, after which the calculator always stops all operations - e.g. overflow of the number of calculation levels.
00..09, 0..9: Enter digit 0..9
0A..0F, 0A..0F: Enter hexadecimal digit (only in HEX mode)
10..1E, A..E'': Shortcut keys used to quickly call subroutines. Subroutines are indicated by the Lbl label followed by the key code A...E''
20, 25, CLR: Clearing calculations. Interrupts the started operations and resets the X register. Neither the T register nor the memory registers are reset.
21, 2A, 2nd, 3rd: Alternative functions. Pressing 2nd and pressing the button activates the alternative function listed above the button. Pressing 2nd twice activates the second alternative function.
22, INV: Inverse function. Many functions also have an inverse function that is called when the INV button is pressed. If an alternative function is to be called at the same time by the 2nd button, the 2nd button must be pressed after the INV button is pressed.
23, ln x: Natural logarithm (basis of Euler's constant e). After pressing INV, the natural exponential function is calculated.
24, CE: Error clearing. The button is used both to cancel the indication of the error condition (the display flashes) and to clear the last digit while entering the number. Another function of the CE button is to validate the X register. This can be used e.g. after opening a calculation with the bracket '(', when the display content is marked as a valid operand, otherwise an operation error would be indicated. Note: In the original TI-59 calculator, the CE button clears the whole number to be entered.
26, SBR Ind (SB*): Invoking a subroutine by index in the registry. The function is invoked by pressing the SBR Ind buttons followed by a 2-digit register number containing the target step number 0..1000 or the HEX label code * 256.
28, log: Decadic logarithm (base 10). After pressing INV, the decadic exponential function is calculated.
29, CP: Clearing the program memory and register T. The memory is filled with the value FF, which indicates an empty unused program step. If the CP function is called while the program is running, the program memory is not cleared, only the T register is cleared.
2B, key: Entering the button code. After the function is called, 2 digits are entered. Then the function corresponding to the entered code is executed. HEX digits can also be used as digits.
2C, lg2: Double logarithm (base 2). After pressing INV, the double exponential function is calculated.
2D, rnd: Random generator. A random number in the range 0 (inclusive) to 1 (exclusive) is generated. After pressing INV, a random number in the range 0 to the number entered on the display is calculated - i.e. the generated random number is multiplied by the number on the display. The random number generator uses a 32-bit pseudo-random number generator. Each time the calculator is switched on, a new default generator value is stored in the EEPROM, ensuring that the generator sequence is always different.
30, tan: Calculate the tangent for the currently selected angular measure. After pressing INV, the inverse function, the arcus tangent, is calculated.
31, LRN: Activation of the programming mode. In the programming mode, button codes can be written to the program in EEPROM. The address (program step number 000..999) is displayed at the beginning of the 2nd line, followed by the HEX code of the button and the text designation of the button. The 1st line of the display shows the contents of the 5 memory steps around the current location. The program can be scrolled through using the SST and BST buttons. A jump to a given address in the program can be made by turning off the program mode, using the GTO button to jump to the address or label, and reactivating the program mode.
32, x<>t: Interchange of registers X and T. Register T is an auxiliary intermediate register, also used for some special operations (e.g. coordinate conversion with P->R).
33, x2: The square of X.
34, Vx: The square root of X.
35, 1/x: The inverted value of the number X.
36, Pgm: Program selection. Pressing the button is followed by entering the 2-digit program number from the currently loaded program module. The module program cannot be viewed in the editor, but pressing A..E' or SBR will bring up the program from the currently selected program module. Selecting the number 00 will select back the user program in EEPROM, programs will still be run from the user program. The selected program from the module can be loaded into the EEPROM using Op 09 and subsequently viewed or edited. If the function is used in a program, there is no permanent program switch, but only one subsequent subroutine from the specified program is called.
37, P->R: Conversion of polar coordinates to Cartesian coordinates. Enter the radius (radius) on the display, press x<>t to store it in the auxiliary register T and enter the angle (in the currently selected angular measure). Press 2nd P->R to display the Y coordinate, press x<>t to display the X coordinate. Pressing INV performs the reverse function, converting Cartesian coordinates to polar coordinates. The X coordinate is entered first, press x<>t to store it in the T register and enter the Y coordinate. Pressing INV 2nd P->R will display the angle (in the currently selected angular measure) and pressing x<>t will display the radius.
38, sin: Calculate the sine for the currently selected angular measure. When INV is pressed, the inverse function, arc sine, is calculated.
39, cos: Calculate the cosine for the currently selected angular measure. After pressing INV, the inverse function, arcus cosine, is calculated.
3B, x<>y: Interchanges the X and Y registers used in the currently open compute operation.
3C, snh: Calculate the hyperbolic sine. When INV is pressed, the inverse function is calculated.
3D, csh: Calculate the hyperbolic cosine. When INV is pressed, the inverse function is calculated.
3E, tah: Calculate the hyperbolic tangent. After pressing INV, the inverse function is calculated.
40, Ind: Index. Many functions allow you to use index operations, where the operation parameter is not taken from the program, but from the registry. The button is pressed after the function is called, but before any other parameters are entered. The button press is followed by a 2-digit code representing register number 00..99 with the operation parameter (register number, jump address, switch number).
41, SST: Step forward when browsing the program memory. If program mode is disabled, 1 instruction is executed according to the currently set program pointer.
42, STO: Saving the contents of the disk to the registry. This is followed by a 2-digit code with the register number 00..99. The Ind button can be used to address the register indexwise.
43, RCL: Calling a number from the registry. This is followed by a 2-digit code with the registry number 00..99. The Ind button can be used to address the register indexwise.
44, SUM: Adding a number to the register. This is followed by a 2-digit code with the register number 00..99. The Ind button can be used to address the register indexwise.
45, yx: Power. The first number is multiplied by the second number. After pressing INV, the inverse operation, square root, is performed.
46, Ins: Insert a blank space into the program. When the button is pressed, during programming mode, the FF code is inserted at the current position to indicate an empty unused step. The following program code is moved 1 position. Unlike the original TI-59 calculator, the entire remaining program memory is not removed, but only the section up to the next step with a free FF position. This makes it possible to have the program divided into sections, separated by an empty FF space, and to edit the current section without affecting subsequent sections. After inserting a step into the program, it is necessary to correct any absolute jump addresses that may have been affected by the operation; the calculator does not correct the addresses itself.
47, CMs: Clearing memory cells (clearing numeric registers). After pressing INV, the auxiliary alternative function ClrSta is executed - only registers 01 to 06, used in statistical operations, and registers X and T are cleared.
48, Exc: Exchange of registers. The display content is swapped with the specified register. This is followed by a 2-digit code with the register number 00..99. The Ind button can be used to address the register indexwise.
49, Prd: Multiplying the register by a number. Followed by a 2-digit code with register number 00..99. The Ind button can be used to address the register indexwise. After pressing INV, the inverse function is performed - register division by number.
4B, n!: Calculate the factorial. The factorial is calculated by an approximation function and therefore decimal numbers can be entered. The factorial can be entered up to a value of approximately 3000.
4C, lnn!: Calculate the natural logarithm of the factorial. Decimal numbers can also be entered. The calculation is not limited by the integer factorial range 3000.
4D, lgn!: Calculate the decadic logarithm of the factorial. Decimal numbers can also be entered. The calculation is not limited by the range of the integer factorial 3000.
4E, mod2: Operation modulo, i.e. the remainder after division. Unlike the mod variant, this operation rounds the quotient down, which results in the sign of the divisor being preserved.
50, IxI: Absolute value of the number.
51, BST: Step back when browsing the program memory.
52, EE: Entering the exponent of a number. After pressing the button you can enter the decadic exponent of the edited number in the range of up to 4 digits. Numbers will continue to be displayed with the exponent until the CLR button is pressed to cancel the exponent mode. The exponent display mode can also be cancelled by pressing INV EE. The EE button can also be used to start editing a number on the display. By pressing EE, the exponent of the number can be changed, and by pressing the dot button, the mantissa numbers can be changed.
53, (: Opening a bracket operation. Brackets can be used up to level 15.
54, ): Closing the parenthesis operation.
55, :: Dividing two numbers.
56, Del: Deleting a program step. The following program code is incremented by 1 position. Unlike the original TI-59 calculator, the entire remaining program memory is not transferred, but only the section up to the next step with free FF space. This makes it possible to have the program divided into sections, separated by an empty FF space, and to edit the current section without affecting subsequent sections. After cancelling a program step, any absolute jump addresses that may have been affected by the operation must be corrected; the calculator does not correct the addresses itself.
57, Eng: Turning on the technical (engineering) exhibit. Numbers will be displayed with an exponent in multiples of 3. Unlike EE mode, this mode is not turned off by pressing CLR, but only by entering INV 2nd Eng.
58, Fix: Set the number of displayed decimal places. Pressing the button will enter the number of decimal places in the range of 0 to 8. The number 9 will disable the limited decimal place mode, as will pressing INV 2nd Fix. Setting the number of decimal places does not affect the accuracy of the calculations, which are performed continuously with maximum precision (19 digits). Non-displayed digits can be trimmed by pressing EE, which will enter edit mode and only the digits shown on the display will be valid.
59, Int: Integer. The number on the display is rounded to zero, i.e. the decimal places are trimmed. After pressing INV, the reverse operation is performed, leaving only the decimal places, keeping the original sign.
5B, SHL: Shift the number 1 bit to the left. This corresponds to multiplying the number by 2.
5C, SHR: Shift the number 1 bit to the right. This corresponds to dividing the number by 2.
5D, round: Rounding. The number on the display is rounded to the nearest whole number. For example, 5.2 changes to 0.2 (corresponding to the INV Int function), while -5.2 changes to 0.8 (corresponding to INV Int + 1). This function can be used, for example, to align intervals to a valid range, such as aligning angles to the range 0..360°.
5E, mod: Operation modulo, i.e. the remainder after division. Unlike the mod2 variant, this operation rounds the quotient towards zero, which results in the sign of the quotient being preserved.
60, Deg: Switch angular measure to degrees.
61, GTO: Jump to the address in the program. A 3-digit address number can be entered as a parameter. By pressing a button other than a digit, the button code is used as a label. In this case, it jumps to the location marked with Lbl in the program. If the Ind button follows, a 2-digit register number can be entered with the jump address. The contents of the register can either be an address number in the range 000..999, or it can contain the HEX code of the signal button multiplied by 256. If a program is running, the current status of the running program can be displayed by holding the GTO button.
62, Pgm Ind: Program selection as for the Pgm function, but the program number is taken from the index register.
63, Exc Ind: Register swapping as for the Exc function, but the register number is taken from the index register.
64, Prd Ind: Register multiplication/division as for the Prd function, but the register number is taken from the index register.
65, x: Multiplying two numbers.
66, Pause: Pause the program for a brief moment and display the contents of the screen.
67, x=t: Conditional jump. If the contents of the X and T registers are the same, the jump to the next address or label is performed. If the Ind button code follows, the address from the index register is taken. When INV is pressed, the inverse function is executed; the jump is executed if the registers do not match.
68, Nop: Empty command, no operation.
69, Op: Special Operation. Printing is done to the PRINT.TXT file on the SD card (or to the emulator directory). This is followed by a 2-digit code with the operation number:
6A, JRF: A relative leap forward. The following is a 2-digit number representing the jump offset (00..99), how many subsequent program steps the instruction should skip. A relative jump has the advantage of not being affected by program scrolling in memory. You can also use an index register with Ind.
6E, AND: Bitwise product.
70, Rad: Switch angular measure to radians.
71, SBR: Calling a subroutine. A 3-digit address number can be entered as a parameter. By pressing a button other than the digit, the button code is used as a label. In this case, it jumps to the location marked in the program with the Lbl label. If the Ind button follows, a 2-digit register number can be entered with the jump address. The contents of the register can either be an address number in the range 000..999, or it can contain the HEX code of the signal button multiplied by 256. If the Pgm command is specified before the function, a subroutine from the selected module program is called. Pressing INV performs the opposite function - return from the current program (code 92, RTN).
72, STO Ind: Store the register number as for the STO function, but the register number is taken from the index register.
73, RCL Ind: Read a register number from the register as in the RCL function, but the register number is taken from the index register.
74, SUM Ind: Adds a number to the register as in the SUM function, but the register number is taken from the index register.
75, -: Subtraction of numbers.
76, Lbl: Label. Followed by a button indicating the label name. GTO, SBR, etc. can jump to this label.
77, x>=t: Conditional jump. If the content of the X register is greater than or equal to T, a jump to the next address or label is performed. If the Ind button code follows, the address from the index register is taken. When INV is pressed, the inverse function is performed, and the jump is made if the contents of X are less than T.
78, Sta+: Statistical function. Enter X, press x<>t to move to register T and enter Y. Press Sta+ to store this pair of numbers in statistical registers 01..06. The display shows the number of pairs of values already entered and the value of X in register T is automatically incremented by 1 - this allows only Y values to be entered. Once all values have been entered, functions such as calculating the mean or coefficients of a regression line can be called. Before starting the input, the statistical registers need to be reset - this can be done either by subroutine CE of program 1 of the ML library module, or by pressing the INV 2nd CMs buttons. After pressing INV, the opposite function is performed - the entered number is subtracted, so that corrections can be made to incorrectly entered values.
79, Avr: Calculate the average of the given statistical values. The display will show the average of the Y values, the T register will show the average of the X values.
7A, JRB: A relative jump back. Next, enter a 2-digit number representing the jump offset (00..99), how many program steps the pointer should be moved back. The offset is relative to the address following the end of the JRB instruction, i.e. a value of 0 means to continue on without change. A relative jump has the advantage of not being affected by program scrolling in memory. An index register can also be used with Ind.
7B, XOR: Bitwise exclusive sum.
80, Grad: Switching angular measure to grads.
81, RST: Reset the instruction pointer to 0. At the same time, the switches and the subroutine stack pointer are reset. When running a program from the program module, the program stops.
82, HIR: Special internal function working with the operation register stack. Followed by a 2-digit numeric code:
83, GTO Ind: Jump in the program as for the GTO function, but the address/label is taken from the index register.
84, Op Ind: Special operations as for the Op function, but the function number is taken from the index register.
85, +: The sum of the numbers.
86, StFlg: Switch settings. This is followed by the 1-digit switch code 0..0F (16 switches can be used). The switch number can also be read from the index register using the Ind prefix. Setting switch 8 causes the program to stop on error.
87, IfFlg: Conditional jump. This is followed by a 1-digit code with switch number 0..0F and the jump address in the form of a 3-digit number or label. Index registers can also be used. If the switch is set, the jump is made to the given address. When INV is pressed, the opposite function is performed - the jump is performed if the switch is not set.
88, D.MS: Conversion of angular or time data expressed in minutes and seconds to decimal. Enter a number, the whole part of which represents the number of degrees or the number of hours. The decimal point is followed by 2 digits representing the number of minutes and 2 (or more) digits representing the number of seconds. The entered figure is converted to decimal by a function. After pressing INV, the reverse calculation is performed - the decimal degrees or hours are converted to minutes and seconds (4 digits after the decimal point).
89, pi: Pi number = 3.1415926535898. After pressing INV, the Euler constant e = 2.718281828284590 is displayed.
8A, Inc Ind: Increment the number as in the Inc function, but the register number is taken from the index register.
8B, HEX: Switching the display to the hexadecimal system.
8C, BIN: Switching the display to binary.
8D, OCT: Switching the display to the octal system.
8E, OR: Bit Sum.
90, List: Printing the program. The content of the user program is printed to the PRINT.TXT print file. Printing takes place from the currently set address. By pressing R/S the printing can be terminated prematurely. After pressing INV, the user registers (memory cells) are printed, starting with the register according to the number on the display.
91, R/S: Start/stop program.
92, RTN: Return from the program (= INV SBR).
93, .: Decimal point. In number editing mode, it is also used to switch from exponent editing to mantissa editing.
94, +/-: Change the sign of a number or exponent. After pressing INV, an alternative function is performed - the display content changes to -1, 0 or +1, depending on the sign of the number. The same function can be achieved via Op 10.
95, = : Performing the calculation. The calculator remembers the last performed operation - if the = button is pressed without entering a new operation, the last performed operation is repeated, e.g. repeated addition of a number, multiplication by a number. By pressing x<>y the operands can be interchanged.
96, Write: Save the program or registers. The operation is indicated by a number on the display. Pressing INV performs the opposite operation, i.e. loading. If it is a hindrance that a program is stored on the SD card together with the registers, this can be handled by a combination with save and restore from the backup EEPROM.
97, Dsz: Repeat loop "decrement and skip if zero". This is followed by a 1-digit code with counter register number 0..0F and the address of the jump as a 3-digit number or label. Index registers can also be used. The counter register is decremented towards zero (also valid for negative numbers) and if it does not reach zero, a jump is made to the given address (the beginning of the loop). If zero is reached, the program continues with the following instruction. After pressing INV, the opposite operation is performed - the jump is performed in reverse if the counter reaches zero.
98, Adv: Print indentation, output 1 blank line to the PRINT.TXT print file.
99, Prt: Printing the X register to the PRINT.TXT print file.
9B, DEC: Switching the display to the decadic system.
9C, Inc: Register incrementation. Increases the contents of the register specified by the following 2-digit number by 1. After pressing INV, the inverse function is performed, decrementing the register contents by 1 (decrementing). You can also use an index register with Ind.
9D, NOT: Bitwise inversion of a number.
9E, %: Percentages. The function is entered during arithmetic operations, after entering the second number. The meaning depends on the operation being performed:
Press the percentage button between 2 numbers to calculate the percentage of the base, as in the multiplication function (1000 % 23 = 230).
Firmware TI59R (setting fuses: low 0xE7, high 0xD7, ext 0xFF)
TI59_module - Converting library modules to binary
Schematic diagram in Eagle Free
Graphic documents (schematic and circuit board)
Complete download of documents
Total price 550 Kc.
Miroslav Nemecek