ZHCAFX9 August 2025 HDC1010 , HDC1080 , HDC2010 , HDC2021 , HDC2022 , HDC2080 , HDC3020 , HDC3020-Q1 , HDC3021 , HDC3021-Q1 , HDC3022 , HDC3022-Q1 , HDC3120
本节概述了如何为 AMM 配置 HDC302x,并说明了与按需触发模式相比的主要差异。
自动测量模式和按需触发之间的主要区别在于:如果用户想要以固定间隔从 HDC302x 传感器读取数据,则自动测量模式更适合其可编程输出间隔。图 2-8 显示了对 HDC302x 进行编程的命令序列,每秒输出一次测量,具有较低噪声和较高可重复性。
// configure HDC302x for Auto Measurement Mode (1 measurement/sec)
// lowest noise, highest repeatability
void deviceInit() {
Wire.beginTransmission(0x44);
Wire.write(0x21); //send MSB of command
Wire.write(0x30); //command LSB
Wire.endTransmission();
delay(15); //wait 15ms before reading
}在器件配置为自动测量模式并且经过足够的时间来完成转换(本例中为一秒)后,使用以下函数来请求存储的测量数据:
// Helper function for requesting data when in Auto Measurement Mode
void requestData() {
Wire.beginTransmission(DEVICE_ADDR); // initiate communication
Wire.write(0xE0); // send MSB of read command
Wire.write(0x00); // send LSB of read command
Wire.endTransmission();
}若要在 AMM 中持续轮询器件,您可以发出读取命令以在配置的采样率(每秒测量次数)下检索最新的测量数据。
此处的 TI GitHub™ 环境传感器存储库提供了演示 HDC302x 在 AMM 中的工作的完整 Arduino 示例——包括器件配置、测量轮询和数据读数。