User`s manual
BL4S100 User’s Manual 45
4.2.3 A/D Converter Inputs
The following sample programs are found in the SAMPLES\BL4S1xx\ADC subdirectory.
You will need a separate power supply and a multimeter to use with these sample programs.
NOTE: The calibration sample programs will overwrite the calibration constants set at
the factory. Before you run these sample programs, run
USERBLOCK_READ_
WRITE.C
in the SAMPLES\UserBlock folder to save the factory calibration con-
stants in case you inadvertently write over them while running other sample programs.
NOTE: For best results use a multimeter with a resolution of at least 4½ digits.
• ADC_CAL_DIFF.C—Demonstrates how to recalibrate a differential A/D converter
channel using two measured voltages to generate two coefficients, gain and offset,
which are rewritten into the user block. The voltage that is being monitored is displayed
continuously.
Once you compile and run this sample program, connect the power supply across a
differential channel pair, then follow the instructions in the Dynamic C STDIO window.
• ADC_CAL_MA.C—Demonstrates how to recalibrate a milli-amp A/D converter channel
using two measured currents to generate two coefficients, gain and offset, which are
rewritten into the reserved user block. The current that is being monitored is displayed
continuously.
Before you compile and run this sample program, jumper pins 1–2 and 5–6 on headers
J10 and J11. Then connect a current meter in series with the power supply connected to
one of pins AIN0–AIN3 and AGND, then compile and run the sample program, and
follow the instructions in the Dynamic C STDIO window.
• ADC_CAL_SE_UNIPOLAR.C—Demonstrates how to recalibrate a single-ended unipolar
A/D converter channel using two measured voltages to generate two coefficients, gain
and offset, which are rewritten into the reserved user block. The voltage that is being
monitored is displayed continuously.
Before you compile and run this sample program, connect the power supply (which
should be OFF) between the pin (AIN0–AIN7) of the channel you are calibrating and
AGND, then compile and run the sample program, and follow the instructions in the
Dynamic C
STDIO window.
• ADC_AVERAGING_SE_UNIPOLAR.C—Demonstrates how to read and display the aver-
age voltage of each of the single-ended analog input channels using a sliding window.
The voltage is calculated from coefficients read from the display—the two calibration
coefficients, gain and offset, in the Dynamic C STDIO window for each channel, and
mode of operation.
Before you compile and run this sample program, connect the power supply (which
should be OFF) between the pin (AIN0–AIN7) of an analog input channel and AGND,
then compile and run the sample program, and follow the instructions in the Dynamic C
STDIO window.