7.7.4. 测试指南¶
7.7.4.2. test_psadc 测试¶
在打开test_psadc的编译后,板子上可直接运行test_psadc命令:
aic /> test_psadc -h
Compile time: Jul 26 2023 08:20:53
Usage: test_psadc [options]:
-c, --channel Select one channel in [0, 11], default is 0
-t, --voltage Input standard voltage, default is 3
-h, --help
Example: test_psadc -c 4 -t 3
7.7.4.3. ADC读取测试¶
ADC数据的读取可以使用shell命令 test_psadc
,每次可读取某一个通道中的当前数据。
aic /> test_psadc -c 4
PSADC ch4: 2432
PSADC ch4-voltage: 1.78 # 未设置标准电压时,采用默认电压3V进行计算
aic /> test_psadc -c 0
[W] hal_psadc_ch_is_valid()320 Ch0 is unavailable! # PSADC0通道没有打开
aic /> test_psadc -c 4 -t 6
PSADC ch4: 2432
PSADC ch4-voltage: 3.56
aic /> test_psadc -t 6
Please select a channel first # 设置标准电压前,需通过-c选择通道