HP Forums

Full Version: how calculator works (aritmethics)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Can somebody please give me some information about how HP calculators works internally, how the calculator make operations, how does it´s microprocessor work and any information that can bring me.

Diana --

I'd say that you need to focus the question -- that's avery broad topic.

It seems that you are concerned about the microprocessor operations rather than the mathematical algorithms. There are a wide range of HP handheld calculators, spanning from 1972 to the present, with different architectures. Extremely detailed information is available for older, discontinued models such as the HP-41, but information on new ones might be proprietary.

-- KS

Generally all recent calculators (including HPs made since 1979) and microprocessors work internally by using an electric field applied to a polysilicon "gate" to control the conductivity through a doped silicon "channel", which is separated from the gate by a very thin layer of silicon dioxide. This device is called a Metal Oxide Semiconductor Field Effect Transistor, or MOSFET.

By carefully arranging the connections between hundreds of thousands of these devices, they can be made to perform useful calculations. How to connect them in such a manner is typically the subject of a multi-year course of study at a university, in the Electrical Engineering and/or Computer Science departments.

@Erich Smith:

Nice to read such posts in the morning... :D :D

How do they make mathematical operations? thats my question.

There is considerable discussion in the technology sections of the MOHPC, and more detailed discussion in some of the forum threads. Perhaps some of the best reading is done in back issues of the HP Journal, copies of which are found on the Museum's CD/DVD distribution. These older articles go into great detail.

As was asked before, Diana, what kind of information are you looking for? Do you want to know more about how chemicals are assembled to make digital electronics? How digital electronics can be used to perform decimal calculations and program control? How decimal calculations and program control combine to make keystroke operations work? How about how would a calculator be built today?

One interesting thing to consider is that many calculators use internal decimal math instead of binary math as is done with most computers. Binary math works great because it's much easier to build, and can thus be very fast. But binary math doesn't allow for exact representation of decimal numbers, leading to minor errors. Most calculators take the trade - spending more effort on decimal math to get answers that are exactly right. (Of course, some functions, like trig and log, will never be exactly right.)

It looks to me like she's looking for things like the programmer's model of the processor, the instruction set, and the source code showing how various functions are calculated. It appears you can get that from CD #5 from this website at www.hpmuseum.org/software/swcd.htm which includes the HP-41C VASM listing.

This "silicon" story is just a myth. All electronic devices actually contain magic smoke. Once you let the smoke out of the device, it stops working.

Those MOSFETs I mentioned previously are wired to act as logic gates that perform logical functions on binary digits (bits). For instance, one of the most common gates is the NAND gate, which produces a '0' output only if both of its inputs are '1', and otherwise produces a '1' output.

Several of these gates wired together form a "half-adder", which can add two addends of one bit each to produce a two bit result. By itself, that's not very useful, but two half-adders together can be wired as a full-adder, which will add three bits to produce a two bit result. That is useful because you can chain full-adders together to add wider data words.

In an HP calculator, the adders are a little more complex because they can be switched between pure binary mode, in which four bits represent a hexadecimal digit between 0 and 15 (F), or BCD mode, in which they represent a decimal digit between 0 and 9. BCD mode is used to implement the higher-level arithmetic functions.

HP calculators use a 56-bit or 64-bit word (48-bit in the case of the HP-01 watch). This is considered to be 14 or 16 digits. The digits are divided into a mantissa and an exponent field in order to represent floating point numbers.

To add two user-entered floating point numbers, the calculator firmware (also sometimes known as microcode) first compares the exponents to see if the numbers have the same scaling. If not, one of the numbers is repeatedly shifted left, and its exponent adjusted, until the exponents match. Then the mantissas are added. The result may have a carry, in which case the result is shifted right and the exponent adjusted again.

There is some additional complication relating to the handling of negative numbers, but this is basically how it works.

Multiplication is performed using repeated shifts and additions. Division is performed using repeated shifts and subtractions. Logarithmic, exponential, trigonometric, and inverse trigonometric functions are performed using a CORDIC technique or series approximations.

If you are into the C programming language, you should look at Eric's wonderful Nonpareil. It contains a emulator for the hardware written in C and the original assembler code of the Calculator. If you start the debugger and step through the execution of sin(), you will know hot it works...!