TS-7180 CPU ADC

From embeddedTS Manuals
Revision as of 10:49, 28 February 2017 by Ian (talk | contribs)

The TS-7180 has four channels of ADC, and those inputs are available on the P3 connector, as AN_IN_1 through AN_IN_4. Each input may be configured to measure voltage in two ranges (0-2.5V and 0-10.9V), or a 20mA current-loop.

The standard linux kernel offers a simple interface to the ADC that does not require any sort of programming to use. For example, to see the "raw" reading from the AN_IN_1 input, type the following command:

cat /sys/bus/iio/devices/iio\:device0/in_voltage5_raw

To convert this raw value to a voltage, it must be multiplied by the "scaling factor", which can be found by typing the following command:

cat /sys/bus/iio/devices/iio\:device0/in_voltage_scale

The result will be in millivolts. If you have the bc utility installed, you can enter the following command:

echo `cat /sys/bus/iio/devices/iio\:device0/in_voltage5_raw` \* `cat /sys/bus/iio/devices/iio\:device0/in_voltage_scale` | bc

To switch to the 10.9V input range, the appropriate enable must be set high. Each input AN_IN_1 through AN_IN_4 has its own enable, EN_ADC1_10V through EN_ADC4_10V, and these are controlled by IO #10 through #13. For example, to switch AN_IN_1 to the 10.9V range, run the following command:

tshwctl -a 10 -w 3

Note that the result must now be multiplied by (10.9/2.5). Note also that the input impedance will now be around 2k ohms.

To switch to the 20mA current-loop mode, the appropriate enable must be set high. These are EN_CL_1 through EN_CL_4, and are controlled by IO #6 through #9. First select the 2.5V range as follows:

tshwctl -a 10 -w 1

And then set the EN_CL_1 enable high as follows:

tshwctl -a 6 -w 3