目前共有1篇帖子。
字体大小:较小 - 100% (默认)  内容转换:不转换
 
点击 回复
129 0
在ADS1115的Config Register寄存器中
巨大八爪鱼
武林盟主 二十一级
回复
1楼 发表于:2026-4-24 14:24
在ADS1115的Config Register寄存器中:
bit11:9 PGA[2:0](电压量程)由设备树的ti,gain属性配置。
bit8 MODE由Runtime PM管理,suspend时为1(Single-shot mode or power-down state),resume时为0(Continuous-conversion mode)。
bit7:5 DR[2:0](数据速率)由设备树的ti,datarate属性配置。
bit4 COMP_MODE由in_voltage0_thresh_either_en和in_voltage0_thresh_rising_en文件内容决定。
当echo 1 > in_voltage0_thresh_rising_en时,COMP_MODE=0(Traditional comparator)。
当echo 1 > in_voltage0_thresh_either_en时,COMP_MODE=1(Window comparator)。
bit3 COMP_POL由设备树的interrupts属性的电平设置决定。
配置为IRQ_TYPE_LEVEL_LOW时,COMP_POL=0(Active low)。
配置为IRQ_TYPE_LEVEL_HIGH时,COMP_POL=1(Active high)。
bit2 COMP_LAT恒为1(Latching comparator)。
bit1:0 COMP_QUE[1:0]由in_voltage0_thresh_either_period文件内容决定。
当设备树里面ti,datarate = <4>时,data->data_rate[dr]=128。
cat /sys/bus/iio/devices/iio:device1/events/in_voltage0_thresh_either_period
输出0.007812。
这是因为COMP_QUE=0(Assert after one conversion)。
1÷128=0.0078125

2÷128=0.015625
echo 0.015625 > /sys/bus/iio/devices/iio:device1/events/in_voltage0_thresh_either_period
cat /sys/bus/iio/devices/iio:device1/events/in_voltage0_thresh_either_period
输出0.015625。
这就把COMP_QUE设为了1(Assert after two conversions)。

4÷128=0.03125
echo 0.03125 > /sys/bus/iio/devices/iio:device1/events/in_voltage0_thresh_either_period
cat /sys/bus/iio/devices/iio:device1/events/in_voltage0_thresh_either_period
输出0.031250。
这就把COMP_QUE设为了2(Assert after four conversions)。
回复帖子
内容:
用户名: 您目前是匿名发表。
验证码:
看不清?换一张
(快捷键:Ctrl+Enter)
本帖信息
点击数:129 回复数:0
作者:巨大八爪鱼
最后回复:巨大八爪鱼
最后回复时间:2026-4-24 14:24
公告板