Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:common:applications:gpio:adc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Previous revision
products:sbc:common:applications:gpio:adc [2022/12/21 21:25]
ivan created
products:sbc:common:applications:gpio:adc [2022/12/21 21:28] (current)
ivan
Line 1: Line 1:
-===== Introduction ===== 
  
-This documentation will introduce the usage of ADC. 
- 
- 
-===== Hardware Information ===== 
- 
-The ADC  is a 12-bit successive approximation register (SAR) A/D Converter. 
- 
-^  Pin  ^ SIGNAL  ^  Voltage  ^  Device Node                                       ^ 
-|  10   | ADC_CH0 |  0~1.8V    /sys/bus/iio/devices/iio:device0/in_voltage0_raw  | 
-|  12   | ADC_CH3 |  0~1.8V    /sys/bus/iio/devices/iio:device0/in_voltage3_raw  | 
- 
-===== Get Raw ADC Value ===== 
- 
-<WRAP important > 
-Replace the variable ''x'' in ''in_voltageX''raw with the corresponding channel value 
-</WRAP> 
- 
-```shell 
-$ cat /sys/bus/iio/devices/iio:device0/in_voltageX_raw 
-``` 
- 
-The following uses Pin10 as an example. 
- 
-```shell 
-$ cat /sys/bus/iio/devices/iio:device0/in_voltage0_raw     // pin10 is connected to 1.8V                                         
-4082 
-$ cat /sys/bus/iio/devices/iio:device0/in_voltage0_raw    // pin10 connects to GND 
-0 
-``` 
- 
-Convert the raw ADC value to Voltage: 
- 
-''Voltage = (value / 4096) * 1.8V'' 
  
Last modified: 2022/12/21 21:25 by ivan