Micromega Chip Does the Math

DN Staff

March 19, 2007

3 Min Read
Micromega Chip Does the Math

If you plan to design a small instrument that must accurately measure temperatures, you can use the types of sensors described in the past three columns. But, your microcontroller (MCU) may require some floating-point math operations to obtain real temperature values from "raw" digitized sensor information. You could use a direct-conversion look-up table or math operations found in most C/C++ compilers. Both approaches can chew up memory space and compiled math functions cut into processor time.

Recently, I experimented with a math IC that operates with floating-point and long-integer numbers. I used the eight-pin uM-FPU V2 chip from Micromega to communicate with a host MCU through a Serial Peripheral Interface (SPI) port. The V2 chip also works with Inter-IC (I2C or I 2C) communications. If you need math capabilities, this chip and its new sophisticated uM-FPU V3 sibling require minimal programming. Both chips conform to the IEEE 754 floating-point standard.

In addition to performing standard math operations, the chips handle logarithms, exponentials, roots and trig functions. (The V3 chip also performs matrix operations.) Both chips offer plenty of temporary storage and preloaded constants such as e, pi, 1, 0 and so on. You also can program your own constants, which makes this chip particularly useful when you need polynomial equations and coefficients to "linearize" data from specific thermocouples, thermistors or RTDs to obtain real temperatures.

MCU vendors provide code libraries and documentation that ease the job of communicating with a uM-FPU chip through an SPI or I2C port. Thus you work with high-level commands rather than control MCU registers and bits. The uM-FPU chips accept data as strings of ASCII characters and commands as one- or two-byte operation codes, which simplifies programming. The LOG10 command (hex E2), for example, takes the base-10 log of a value and SQRT (hex E0) computes a square root. In C/C++ you predefine an op-code with a statement such as "#define SQRT 0xE0." Then you can use the mnemonics to code uM-FPU-chip operations. The capability to work with numeric data as ASCII strings, rather than a mish-mash of hex codes and binary numbers, simplifies programming.

Because uM-FPU chips use many internal registers, it can take time to get used to how the chip manipulates values, handles operations and tracks data. But because Micromega provides a programming IDE, you can quickly develop code for several target processors. The code also creates uM-FPU "assembly language" listings for the chips, so you can translate them into the hexadecimal codes if you must go this route.


Useful Links

  • For more details of my experiments, go to the Design News Electronics/Test Forum

  • Get more information on hexadecimal notations

Sign up for the Design News Daily newsletter.

You May Also Like