Pic Microcontroller Choosing for Calculator Project - Page 1
Forum section: electronics / general

author: brue
author_rank: Contributor
timestamp: July 19, 2012, 10:26:28 am
content: Hi thereI really like Daves uCalc, so i want to design my own one.I would like to use a PIC micro with mtouch technology.Its a big Problem for me to choose a ideal controller. I dont know how much RAM do i need, how much ROM do i need. Should i use a 16 Bit or better a 32 Bit controller?Uses Dave a single mtouch Channel for every button, or any matrix? I think it would be better with a single button per channel design.Thanks for every part suggestion or other ideas.

author: Psi
author_rank: Super Contributor
timestamp: July 19, 2012, 10:32:21 am
content: If you mean his calculator watch then one of the critical design factors will be power consumption.Since the battery space is small and a watch should last a while before needing a new battery.You'd want the button system to be on hardware interrupts so buttons can wake up the micro automatically.I don't know much about the mtouch technology but you should check it's power requirements. If it needs continuous power it may not be suitable.EDIT: Ah, i see the one you mean, the credit card sized calculator. At least with that it doesn't need to display information 24/7 like a watch, so power consumption isn't quite as critical.You still need a ultra low standby current though, unless you have a hard power switch.

author: kripton2035
author_rank: Super Contributor
timestamp: July 19, 2012, 10:40:42 am
content: I'm pretty sure that a 8 bits pic18 would be enought to make a small calculetor like the uCalc ...dave uses a pic24, ok but it's too much in my mind.so a 32 bits why not, but to calc simple orepations it's not needed.first determine what type of calculations you want to implement, then you can choose the controller.

author: brue
author_rank: Contributor
timestamp: July 19, 2012, 12:12:55 pm
content: Ok i will give some more informations.Its not like a watch, its in credit card format. I would like to build it with RPN/UPN functionality (Like a HP 15c etc) with the typical scientific functions like:-Standard operations-sin cos tan-root, exp-Log, Ln-Numeral system convertionsEventually later extended funkctions like pre programmed constants, support for complex numbers, Statistical operations, etc.Thanks for your support

author: olsenn
author_rank: Frequent Contributor
timestamp: July 19, 2012, 01:25:42 pm
content: Use whatever micro you'd like, but for the love of god, please program it in assembly language and don't use Li-Ion batteries (keep it to AA or AAA NON-RECHARGABLE batteries)

author: Mechatrommer
author_rank: Super Contributor
timestamp: July 19, 2012, 02:01:03 pm
content: Quote from: olsenn on July 19, 2012, 01:25:42 pmwhat?! you want to do sin and lon in assembly? i hope you will not unintentionally defaming god for giving such suggestion.

author: poorchava
author_rank: Super Contributor
timestamp: July 19, 2012, 02:01:18 pm
content: use anything that proves to consume the least power. First shot would be something from MSP430 or NanoWatt PIC18 families. A calculator doesn't need any serious processing power so anything including 8051 is perfectly good as long as it draws very low current.

author: T4P
author_rank: Super Contributor
timestamp: July 19, 2012, 03:48:01 pm
content: Don't forget the Geckos ... From energy micro

author: olsenn
author_rank: Frequent Contributor
timestamp: July 19, 2012, 05:47:53 pm
content: QuoteAssembly is really not that difficult for things like that... sin for instance is just a Taylor series of finite resolution (you define the resolution) which is easy if you already have the low level bit operators to JMP to. Take a look at the free online book, Matters Computational; it is written more for C, but it provides great algorithms for doing some neat things at a very low level.

author: Mechatrommer
author_rank: Super Contributor
timestamp: July 20, 2012, 01:19:12 am
content: thanks for the sin info olsen, never thought of the taylor series since i took that for granted in higher level language. but what specific i have in mind is... do you want to code all the floating point operations in assembly? perharps you already have the readymade library? fair, then are you willing to code 4 or 8 lines of assembly just to move one FP argument or pushing it to stack?

author: hans
author_rank: Super Contributor
timestamp: July 21, 2012, 11:14:27 pm
content: Well, a PIC18 of PIC24.. do the power comparisons. Some PIC24 claim XLP (Xtreme Low Power) or something.PIC32 is more power hungry.But as always, you don't need to run the controller at full speed. PIC24 allows very flexible clocking, I dunno how good the PIC18's are in that respect (haven't played much with them).Oh btw.. assembler? AVOIDOpen source projects are cool. Have you ever seen 'open source' embedded projects that are completely written in assembler and are noticeable? I haven't.It's probably because open source benefits from developers joining. I don't feel encouraged to digg around some assembler code to understand it and expand it.Don't get me wrong. I do some inline assembler for things like context switching in RTOS, or some x86 assembly on some game (Race simulators) data mining, but I'm glad a compiler knows it's tricks.Assembler sounds stupid. Implementing an algorithm for sin may take yourself an afternoon. I can just type sin() and it works.Maybe I want a boot loader too so I can update the program via an UART.Or an RTOS so I can multitask things (altho for a calculator.. hmm)Anyway..I believe Dave uses a matrix. Don't know for sure. His video's about the project are quite explanatory.I don't think you need 32-bit power. 16-bit sounds good enough. 8-bit may be a bit low if you want to multiple 32-bit integers or floats, because it has to do a ton of instructions to calculate that.RAM and ROM? Well, I don't think a calculator needs a lot of RAM. But I see most PIC24 series are in the 4k+. Should be plenty.ROM: well, I know for matter of fact that you can port programs between PIC24F very easily.If you get yourself a PIC24F DIP version, breadbord it up with an LCD and some buttons (Do the touch on a PCB later), and experiment. You'll soon figure if need 8K or 64K for the project.Honestly I don't know. I only used PIC24F with USB before, which eats a ton of ROM.

author: IanB
author_rank: Super Contributor
timestamp: July 22, 2012, 01:44:48 am
content: Quote from: brue on July 19, 2012, 10:26:28 amYou are approaching this the wrong way.The golden rule of engineering is that the first one you build will be the prototype that you discard.So if you have not built anything yet, what you are going to build is your prototype. And for a prototype it doesn't much matter how much RAM or ROM you need, or what the exact design turns out to be.Just get a big micro with plenty of memory and interfaces and breadboard your design. Use that design to figure out what you really need to build the real one, then go ahead and build that. Nobody can answer your questions except yourself, and the only way you can find the answers to the questions is to build a prototype and see what you discover.

author: Zad
author_rank: Super Contributor
timestamp: July 22, 2012, 04:29:45 am
content: Any specific reason you are going with the PIC? The new ARM cored micros have a lot better power efficiency and overall speed (should it ever be needed).

author: amyk
author_rank: Super Contributor
timestamp: July 22, 2012, 10:20:51 am
content: Quote from: brue on July 19, 2012, 12:12:55 pmTo give you an idea of the hardware requirements, a real HP 15c used an ASIC at 220kHz and consumes around 1.2mA active and <100nA standby; they recently produced a reissue of it using a standard Atmel ARM chip and the power consumption went up to 19mA active and 4uA standby.Also, good (accurate) calculators don't use standard binary floating-point, but BCD-based custom numerical formats.

author: slateraptor
author_rank: Frequent Contributor
timestamp: July 26, 2012, 07:50:00 am
content: Quote from: olsenn on July 19, 2012, 05:47:53 pmHow would you rate the book? I'm always on the lookout for exceptional reference literature to add to my personal library.

author: poorchava
author_rank: Super Contributor
timestamp: July 26, 2012, 10:51:57 pm
content: I know that there are two trends in low-power programming which can be called 'lowest frequency' and 'burst'. First one achieves low power consumption by lowering the clock speeds to minimum, the second one relies on executing given task as fast as possible and then going to deep sleep mode (or whatever it is called). Both can be mixed with each other and both can benefit from using specialized cells like FPU, hardware trygonometric function tables, hardware polynominal calculation etc.

author: baljemmett
author_rank: Unknown
timestamp: July 26, 2012, 11:11:18 pm
content: Quote from: poorchava on July 26, 2012, 10:51:57 pmDave discussed some of the implications of this in one of his (very!) early videos:EEVblog #4 – Low Power Calculator Design and FPGAs.(Strange-looking envelopes in Dave's old lab)

author: Bloch
author_rank: Unknown
timestamp: July 27, 2012, 07:21:40 pm
content: Quote from: poorchava on July 26, 2012, 10:51:57 pmYes lower the frequency the lower will the Power use be. ( example PIC12F675 )Standby Current:- 1 nA @ 2.0V, typical• Operating Current:- 8.5 uA @ 32 kHz, 2.0V, typical- 100 uA @ 1 MHz, 2.0V, typical

author: SteveyG
author_rank: Unknown
timestamp: July 30, 2012, 07:25:27 am
content: Microcontroller choice shouldn't be too critical so long as it has enough I/O for your needs. Most calculators are based on 4 bit processors anyway!

author: FenderBender
author_rank: Super Contributor
timestamp: July 31, 2012, 09:57:20 pm
content: Quote from: SteveyG on July 30, 2012, 07:25:27 amYea most calculators are running on 4-bit or 8-bit MCUs or CPUs. 8052 is a popular one. Still used today. It's nothing extraordinary.

author: rbk17c
author_rank: Newbie
timestamp: July 31, 2012, 11:12:05 pm
content: Being a self-confessed PIC fan-boy, I would go with some XLP pic18. It might get a bit hard to get it to do trigonometry, but at least you have a 8X8 HW multiplier. :-)- Do as IanB suggests: Start with a big chip, and reduce when you have your (almost) finished code. (Only the pricetag differs) Take a look at something like pic18f26K22 in I/SP (=DIP). Try to design it, so that you can have the programmer connected all the time you program. - if you can, don't use the IPCS pins for anything else.Use the internal oscillator.The touch thiggy "CTMU" uses VERY little power - something in the order of 1/2 uA. (I think it is actually designed with batteries in mind).Hans: are you trying to start a religious war:-) I love coding in assembler, - I don't like the waste of space poor c-compilers produce.But I relinquish. Hans is right. Use the right tool for the right job! Some hi-speed display updates: ASM; calculating square-root of (2*Pi)? use C (And a VERY good math library.)./holger

author: brue
author_rank: Contributor
timestamp: August 03, 2012, 08:25:36 pm
content: Thanks a lot for all your "inputs", i definitly dont programm it in assembler. This is because i havent got any expirience with assembler. Im working currently with the 24FJ128GB106 on the cap evaluation board. Later i would do some tests with the 24F32KA304, a controller with xlp nano watt technology.