![]() ![]() And it was possible with some additions to the compiler. But instead of doing this, I got the idea to take up his challenge, and compile code directly into the EEPROM. My first reaction was to tell him that he is stupid, he should know, that no program will run on EEPROM. My boss back then told me to use tho onboard EEPROM for code. I was asked to add new features, but the FLASH was used to the brink. Ten years ago I had a microcontroller project with a M38049. Assembly language programs won't work on serial memory. I am sure you wrote your answer with assembly language in mind. The upper layers, let's say the human interface and the communication interface, can reside in the SPI-FRAM. The trick is to factorize the software in a way that the time consuming parts are stored in the microcontroller FRAM. Of course there is a time penalty involved. I will also need some kind of keypad which I might also have done on the laser cutter.An external SPI FRAM can be used for extra code storage, for on-the-fly variable storage, and for data storage. Hopefully I can do this in SolidWorks and have it cut on a 3D printer. One of the last things left for the hardware is to build or print some kind of case to go around everything. Male headers are used to give the pieces more stability. The whole body of the calculator is made from protoboard. Hopefully the batteries will last at least 6 hours with this set up. Voltage regulation is done by a small switching supply that steps the batteries down to 5v. The SRAM and microcontroller should draw less than 100mA together but the VFD can draw as much as 400mA. Power is provided by two 18650 batteries rated for 2000mAh. Using just three chips is much more compact than the original. The displays requires its ready pin to be read before sending more data so I connected it to one of the 5v tolerant pins on the LPC1114. The displays runs on 5v so I used a 74HC245 for level translation. The display is a very nice 128x32 VFD made by Noritake which allows four lines of 18 characters. The 30 buttons of the keypad are multiplexed on 11 pins. The microcontroller is connected to a 128k SRAM chip that it communicates with over SPI. The LPC1114 has 32k of flash and is easily able to hold the entire firmware, while the original project needed two MSP430s. In the future I plan to add more robust programming features like looping, conditionals, and labels. So far the functions only repeat the commands entered into the editor. There are 10 functions keys that can be programmed with an onscreen editor. This is the main new feature added to this version. After setting the accuracy, the program finds the largest element in the CORDIC table that is still significant, so that no time is wasted on elements that have no effect on the answer. With 32 decimal places calculations take less than a second, which is at least 5 times faster than the original calculator. The settings page allows the accuracy to be set from 6 to 32 decimal places. One way to measure the accuracy of calculations is with the calculator forensic found here. I was able to speed the shifting up even more by using another lookup table that let me right shift 4 digits at a time. Instead, a lookup table is used with adds and shifts, which are much faster. This is a very efficient way to compute these functions for processors that cannot multiply or divide quickly. The trig and log functions are computed using CORDIC routines. The size of numbers had to be shrunk to 120 places down from the original 255 so that all the buffers would fit in the microcontroller's 4k of RAM. This is much faster than the original RPN Scientific Calculator which used external RAM for buffers during calculations. The stack is stored on an external SPI SRAM but all calculations are done using the internal RAM of the microcontroller. ![]() The interface shows 4 levels of the stack, similar to some HP calculators. Keystroke programming with 10 user defined functions Functions: (a)sin, (a)cos, (a)tan, y^x, x root y, e^x, ln, 10^x, log, mod Internal accuracy configurable from 6 to 32 decimal places It is smaller, faster, and uses less parts. ![]() It uses an LPC1114 microcontroller and adds keystroke programming. This is an improved version of the first RPN Scientific Calculator ( ) I made. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |