Post Reply 
AriCalculator is a home made pocket calculator.
02-05-2018, 04:25 AM
Post: #61
RE: AriCalculator is a home made pocket calculator.
Thanks Pauli,

I'll use the linear congruential generator for now, despite its faults, as I can implement it easily by writing a keystroke program, saving the hex codes in a table, and executing the program whenever the random number key is pressed on the calculator. Not as fast as an assembly language implementation but allows me to quickly add new functions to the firmware. I've done the same for the hyperbolic functions.

I've been using the CodeWarrior IDE (no code limits for assembly language programs) and have written about 45Kb of assembly code to create a programmable calculator with basic scientific functions, and hope to implement complex numbers and an exact mode in under 64Kb by the end of the year.

What algorithm did you use for the gamma function? Also what microcontroller does the WP 34S use, how large is the firmware and what development tools did you use?
Find all posts by this user
Quote this message in a reply
02-22-2018, 04:47 PM
Post: #62
RE: AriCalculator is a home made pocket calculator.
Hello Daniel,

Wouldn't it be easier (and more random) to extract random numbers from hardware? On the AriCalculator for example, you can measure A/D conversion noise, PLL jitter, and the timestamp of key strokes.

Dirk
Visit this user's website Find all posts by this user
Quote this message in a reply
02-25-2018, 03:44 AM
Post: #63
RE: AriCalculator is a home made pocket calculator.
Hi Dirk,

That's an interesting way to generate a random number. And by concatenating several ADC conversions you could get quite a range. It's also great for setting the seed - you don't have to save the most recent number generated in EEPROM/FLASH.

Daniel
Find all posts by this user
Quote this message in a reply
03-15-2018, 03:51 AM
Post: #64
RE: AriCalculator is a home made pocket calculator.
I decided to implement the 64-bit xorshift generator described on page 4 of George Marsaglia's "Xorshift RNG's". It involves shifting the seed 13 bits to the left, followed by 7 bits to the right and then 17 bits to the left, with a bit-wise exclusive OR performed after each shift. Any non-zero value can be used as the seed, and according to the author it passes all tests of randomness, except the binary rank test.
Find all posts by this user
Quote this message in a reply
03-15-2018, 05:23 AM
Post: #65
RE: AriCalculator is a home made pocket calculator.
Sorry, missed this.


(02-05-2018 04:25 AM)Dan Wrote:  What algorithm did you use for the gamma function?

Lanczos. Tuned to the precision we were using.


Quote:Also what microcontroller does the WP 34S use

Atmel AT91SAM7L128


Quote:how large is the firmware

A bit over 122kbytes. The rest of flash is used for the RAM backup and the libraries.


Quote:what development tools did you use?

Most of the development was done off device. I used Linux & MacOS. Some was done using Windows. For the firmware, we built on Windows using the Yagarto GCC 4.6.0, other versions and other compilers we tried later exposed a compiler bug so we reverted and didn't try again - if it isn't broken and all that.


Pauli
Find all posts by this user
Quote this message in a reply
03-16-2018, 09:30 AM
Post: #66
RE: AriCalculator is a home made pocket calculator.
Hi Pauli,

Very nice, thanks. My understanding is that HP has discontinued the hardware you were using. Hope you find a way to keep the WP 34S project going.
Find all posts by this user
Quote this message in a reply
04-03-2018, 04:57 AM
Post: #67
RE: AriCalculator is a home made pocket calculator.
I have now implemented complex numbers:

[Image: Image_2_zps6wkulet4.jpg?1522730988931&am...2730989467]

[Image: Image_3_zpsehx1swq3.jpg?1522730988931&am...2730989467]

The functions available in complex mode are: /,*,-,+ and conjugate, modulus, conversion to polar form and conversion to Cartesian/rectangular form.

I can now add new functions to the calculator by copying the hex codes of programs written on the calculator to the firmware. For example, the following program is executed when the |z| key is pressed:

[Image: Image_4_zpsvbbzx75v.jpg?1522730988931&am...2730989467]

[Image: Image_5_zpsrbm95rmr.jpg?1522730988931&am...2730989467]

I will implement sqrt(z) in a similar way.
Find all posts by this user
Quote this message in a reply
04-03-2018, 07:35 AM (This post was last modified: 04-03-2018 07:37 AM by Zaphod.)
Post: #68
RE: AriCalculator is a home made pocket calculator.
I've not read the entire thread just yet, but picking up on this:

Quote:@KeithB: The laser engraved labels are better readable once they have been colored with acrylic paint.

Or you could use coloured acrylic (or another sort of opaque coloured filter) behind the clear laser cut letters, a work neighbour here who makes has a laser cutter and does this all day for Raspberry Pi products he makes for his company.


I like it, it reminds me of an Mk14 ...........
https://en.wikipedia.org/wiki/MK14
Find all posts by this user
Quote this message in a reply
04-07-2018, 09:00 AM
Post: #69
RE: AriCalculator is a home made pocket calculator.
The MK14 looks like a pretty cool kit. Elenco also have one:

https://www.elenco.com/product/micromast...ining-kit/

It uses an 8085 DIP microprocessor. I wonder who still makes these chips?

I think the AriCalculator has a bit of a retro feel to it. All the code is written in assembly and we're looking at connecting shift registers to the calculator's SPI expansion port so that the calculator has GPIO pins to connect electronic components to.
Find all posts by this user
Quote this message in a reply
05-21-2018, 08:56 AM
Post: #70
RE: AriCalculator is a home made pocket calculator.
The AriCalculator has an NXP S12 microcontroller with 240kB FLASH. I am considering porting the firmware to the NXP S12XEP100, which has an almost identical instruction set but more FLASH memory (1MB).

I can program it in assembly using the CodeWarrior IDE, which is free. CodeWarrior also has a "full-chip simulation" mode that allows you to debug your code without downloading it to the actual device, thereby saving the FLASH on the device from repeated writes.

I am wondering if there are similar microcontroller development environments, i.e. ones that are:

1) free
2) allow you to code in assembly with no code limitations, and
3) feature a simulation mode
Find all posts by this user
Quote this message in a reply
05-23-2018, 01:44 PM
Post: #71
RE: AriCalculator is a home made pocket calculator.
Regarding programming everything in assembly... I used to do that (I started to think about building my own calculator at the end of the 90s), I started with the 68HC11 (a subset of what you have), H8/300H (I had math routines, GUI and plots working), SH-1, AVR. I stopped there and went to C. I can test on the PC and have HAL code for the different microcontrollers I use nowadays: Cortex-M3, M4 and PIC32 (MIPS), and x86. Even a PIC32 at 16 MHz has enough speed that assembly is not required.

I think that MPLABX lets you simulate (for the PIC32), many people does not like it, I used to use netbeans so it is a familiar environment for me.
Find all posts by this user
Quote this message in a reply
05-24-2018, 07:08 AM
Post: #72
RE: AriCalculator is a home made pocket calculator.
Thanks Alejandro, you and I are members of a small group of people who have written firmware for a calculator in assembly, and you may be the only one to have done it in both assembly and C!

Man it was one of the most challenging things I've done and I'm glad the basic firmware is almost finished. By the end of June I'll have all of the standard scientific functions, a random number generator, hex, bin, complex and rational number modes, stack operations, a keystroke programming language with debugger and a soft menu with folders to add new functions to over time. It's about 70kB and has taken 18 months to complete.

How are your projects coming along?
Find all posts by this user
Quote this message in a reply
05-24-2018, 10:46 AM (This post was last modified: 05-24-2018 12:17 PM by Alejandro Paz(Germany).)
Post: #73
RE: AriCalculator is a home made pocket calculator.
I've been busy with the coconut (HP-41) and Saturn cores. I'm developing a "platform" to be able to test the saturn on real hardware.

One aspect that interests me is power consumption:

On the PIC32, I was switching between a low power 32 kHz and a 8 MHz RC oscillator. The limited amount of pins on the DIP28 package forced me to drop an external 32 kHz crystal for the low power oscillator. The timing is the derived from the current selected oscillator forcing me to re-set every time a clock switch occurs Sad.

How did you approach this topic ? What are your figures ?

Yeah assembly has its advantages, I'd just combine it with C for the user interface, I find it tedious to do all that in assembly.

The people who programmed the original TI-85 did it also in assembly (and the derivatives, of course). They used bank switching to increase code size, very interesting. At least the HC12 has bank switch built-in in the opcode map, very nice.

Why do you want to use a part with 1 MB flash ? You have use 70 kBytes of 240... just asking
Find all posts by this user
Quote this message in a reply
05-24-2018, 09:40 PM (This post was last modified: 05-24-2018 11:02 PM by hotwolf.)
Post: #74
RE: AriCalculator is a home made pocket calculator.
Alejandro,

The AriCalculator's CPU runs at 50MHz using the S12G's PLL and internal RC oscillator as reference clock. The MCU's run current is below 17mA. The clocks can be turned of when the device is idle and the USB port is unplugged, reducing the current consumption to about 25uA. The calculator can be then woken up through the keyboard, even when the system clocks are stopped. The display draws 320uA in operation, but can be put in a low power mode as well. The FTDI USB/SCI converter is externally supplied by the USB bus. The calculators MCU and display are powered through a boost converter with the start-up voltage of 0.65V, so it does drain its batteries pretty empty, before it stops working.

While the current S12G240 MCU is small, cheap, and power efficient, the S12XE100 would add some nice features to the calculator:

- 100MHz CPU with extended instruction set
- 32Kb of RAM
- EEPROM emulation which works like a non-volatile RAM
- second CPU (XGATE) to handle all I/O
- external bus interface to add even more RAM
Visit this user's website Find all posts by this user
Quote this message in a reply
05-26-2018, 09:34 AM
Post: #75
RE: AriCalculator is a home made pocket calculator.
(05-24-2018 10:46 AM)Alejandro Paz(Germany) Wrote:  I've been busy with the coconut (HP-41) and Saturn cores. I'm developing a "platform" to be able to test the saturn on real hardware.

Cool, the Saturn is what got me interested in assembly language. Are you using an FPGA?

(05-24-2018 10:46 AM)Alejandro Paz(Germany) Wrote:  The people who programmed the original TI-85 did it also in assembly (and the derivatives, of course). They used bank switching to increase code size, very interesting. At least the HC12 has bank switch built-in in the opcode map, very nice.

I used code banking on the Silabs 8051, but doing it on the S12 is way easier.

(05-24-2018 10:46 AM)Alejandro Paz(Germany) Wrote:  Why do you want to use a part with 1 MB flash ? You have use 70 kBytes of 240... just asking

Dirk is looking into building a batch of calculators for people to try out and even contribute to the firmware if interested. 1MB enables new functions to be added for many years.
Find all posts by this user
Quote this message in a reply
07-27-2018, 08:51 AM
Post: #76
RE: AriCalculator is a home made pocket calculator.
We're also looking at building a colour screen version. Are there any colour GLCD's people have used that they would recommend?
Find all posts by this user
Quote this message in a reply
08-02-2018, 05:35 AM
Post: #77
RE: AriCalculator is a home made pocket calculator.
This one doesn't look too bad:

https://www.adafruit.com/product/358
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)