Close

Data Representation in the Handheld Lab

A project log for Multimeter +

Dual input 24 bit Multimeter with USB interface, single channel 10 bit USB oscilloscope, PWM out, 2 Ch Data-logger, R, C, Digital sniffer.

romanRoman 02/24/2016 at 20:450 Comments

Data is stored and processed in a fixed-point representation. In a fixed-point processor, numbers are represented and manipulated in integer format. In a floating-point representation numbers are represented by the combination of a mantissa (or a fractional part) and an exponent part. In a fixed-point processor, one needs to be concerned with the dynamic range of numbers, since a much narrower range of numbers can be represented in integer format as compared to floating-point format.

Q-format Number Representation

The decimal value of an N-bit 2’s-complement number, B = bN-1bN-2…b1b0, where bi is either 0 or 1, is given by

The 2’s-complement representation allows a processor to perform integer addition and subtraction by using the same hardware. When using the unsigned integer representation, the sign bit is treated as an extra bit. Since my device have to be able to measure positive, negative, as well as AC signals the numbers are represented in sign magnitude format. This allows me to keep track of AC signal for automatic switching between DC and AC measurements. Converting 2’s complement values to sign magnitude requires processing time, but with 16 MIPS speed (PIC24FJ256GA110) it is unnoticeable.

There is a limitation of the dynamic range. For the 24 bit data (MCP3911) maximum positive value is +8388607 and max negative value is -8388608. These values represent number of steps in positive and negative directions. Measured values are represented in Nano-Volts and Micro-Volts, this allows me to keep high resolution of a measurement. To display measurements in Volts I move decimal point accordingly. This representation scheme is referred to as the Q-format or fractional representation.

bN-1 2N-1. bN-2 2N-2 … b1 21 b0 20 Volts or Amps.

The binary number gets converted to a string of characters to be displayed.

Discussions