目前共有1篇帖子。
字體大小:較小 - 100% (默認)  內容轉換:不轉換
 
點擊 回復
125 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)
本帖信息
點擊數:125 回複數:0
作者:巨大八爪鱼
最後回覆:巨大八爪鱼
最後回復時間:2026-4-24 14:24
公告板