Manual 104-AIO16A and 104-AIO16E
34
Step-By-Step: Calibrating the DACs
Now let’s describe these steps in detail.
1.1
Output a known value to the DAC. You should determine the maximum range of the DAC using
Base + 12 (see Chapter 5). Pick a value approximately 5% lower than this maximum. By using a
value lower than the maximum you avoid calibrating off-the-end of the range. Alternately, choose
the voltage most likely to be output by your application in your own use. For example, if you’re
going to be using primarily voltages near 6.2 Volts, you may want to calibrate it at that voltage.
Just substitute whatever voltage you choose in the math that follows.
Output this value to the DAC under calibration.
For example, if your DAC is jumpered for the 0-10 Volt output range, a value of 9.5 Volts (95% of
10 Volts) would be a good choice.
Convert this voltage to a 12-bit digital count value (Counts = (Volts / MaxVolts) * MaxCounts, so:
Counts = (9.5 / 10) * (2^12 - 1) = 0.95 * 4095 = 3890.25. Only a 12-bit integer numbers can be
written to the DAC, so we’ll use 3890 as our count value. This equates to F32 hex, which we’ll
write to the DAC under calibration. Its important that you are precise when calibrating, so don’t
forget about that 0.25 count we threw away. If we run the equation backwards to determine what
voltage F32 counts equates to, we don’t get 9.5 volts. Let’s run the math: Volts = (Counts /
MaxCounts) * MaxVolts, so Volts = (F32 / FFF) * 10 = 0.9499 * 10 = 9.499 Volts. Not quite 9.5
volts.
1.2
Measure the output value of the DAC with a DVM. Now that we know precisely what output
voltage to expect, connect a DVM to the DAC output pin on P1 (pin 25 or pin 26 for DAC 0 or
DAC 1, respectively. Use Pin 24 for ground.) The DVM should be set for DC voltage
measurement. Once connected the DVM should read 9.499 Volts, but may not be exactly correct.
Remember, if you’re using a different “known output value”, you should see a number near it, not
near 9.499.
1.3
Adjust the value in the digital calibration potentiometer for the DAC you’re calibrating until the
reading on the DVM shows your known output value. You adjust this potentiometer’s value using
the process described in Base + 19 in Chapter 5. Probably the best way to quickly find the correct
value is to initialize the potentiometer with half its maximum value (use 80hex), then increment or
decrement the value until the DVM reads accurately.
1.4
Once you’ve determined the value that correctly adjusts the DAC output to match the known
output voltage, store it in the EEPROM for later use. Doing so allows you to re-write the value into
the calibration potentiometer on the next board initialization without resorting to storing the values
in a reference database or calibration configuration files on a hard disk or floppies, etc. The
location into which you store the value varies based on the DAC number you’re calibrating and
the range you have selected on the board via jumpers. Consult
Table B-1
for a list of the
locations the provided Calibration software, samples, and drivers use.
1.5
Repeat these steps for the other DAC.
When you’ve finished these steps the DACs are calibrated. The next time the board is reset, only Step 2
needs to be performed. In brief, this involves reading the value out of the correct EEPROM location and
writing it to the calibration potentiometer. The details of Step 2 are described near the end of this
appendix, following.