Data Files
Instrument Data
Why Do You Need To Know About Instrument Data?
What If You Read Measurements And Store The Results In Data Files?

Instrument Data - Numerical Formats

        Let's imagine a situation in which you are trying to measure, record and analyze some data.  Here is a picture of the situation.

In this situation, the following operations take place.

This kind of sequence of operations is very common today.  In other situations, you might find that the data is used immediately to determine control actions taken.  An example might be a temperature control in a chemical process.  Measured temperature data might be used to determine how much heat to apply to the process.

        In situations like this, although it is not immediately apparent, the data that is measured often goes through many transformations and takes on many different representations.  Think about the following scenario.

        You should realize how many conversions are necessary in this process.         Now, thing about what happens in a spreadsheet.         You probably don't realize it, but if you know how to program you have already done some conversion between those formats.  You did it every time you printed numerical results from a computation.  Still, before you have a complete understanding of data representations you need to understand how instruments generate and store data.  That's the subject of this lesson.  If you just want a summary of the different kinds of representations - with some details - click here.

        When you take measurements with a computer controlled instrument and transmit the data to the computer there are a number of different data formats that you can encounter.  You can encounter data that is represented as characters and data that is stored in numerical formats.

We are going to start by looking at the first step in the process - the measurement of data with an instrument.  Even if you do not run the data through a spreadsheet - or any other analysis program - the first step is to measure things and convert the initial measurement to a digital format.  We will begin by looking at what happens as you use an A/D to convert a measurement into a digital format.

Instrument Data - Background

  Let's look at what happens when you use an A/D.

        There are also relations between the accuracy of an A/D and the accuracy of a DVM.  There are many other questions that arise when you start using digital voltmeters.  The answers to questions about meters can be found in the lesson on DVMs.  Click here to go to that lesson.


What If You Read Measurements And Store The Results In Data Files?

        Let's assume that you're measuring a DC voltage.  You've written a C function called "MeasureDCVolts", and you use it in this program segment.

 float Volts;

 Volts = MeasureDCVolts (instrumentHandle);
 printf ("The measured voltage is  %f volts DC.", Volts);

What happens in this program segment?

        Let's go through this one line at a time.  The first program line measures a voltage and stores the result in a floating point variable "Volts".

Volts = MeasureDCVolts (instrumentHandle);
        If the instrument is a 4-1/2 digit meter, using a 30 volt scale, then the result takes at least 15 bits.  That physical measurement determines how well you know the voltage.  No matter how you manipulate it after that it won't get any more accurate.  A 4-1/2 digit meter on a 30 volt scale will measure to within .001 volt, or 1 millivolt.

        Now, when you take that result and store it in a floating point variable, your're probably putting it into 4 bytes, or 32 bits.  That's a common way to represent a float variable.  You don't gain any precision when you do that.  Sometimes the conversion will give you trailing "9s" or a "1" after a string of zeroes when you print it.  That's irrelevant, but we do need to talk about what happens when you print things.

        You need to consider what happens in a printf statement.  Here's the code from the program segment.

printf ("The measured voltage is  %f volts DC.", Volts);
This line uses the value of the float variable "Volts", and converts the numerical value it finds in "Volts" to a string of characters.  Then it puts those characters in the string surrounding the "%f" and then it prints the characters.  (The "%f" string gives the rule for conversion.)
 


Problems

Links to Related Lessons
Return to Table of Contents

Send us your comments on these lessons.