// AD7606寄存器定义 #define AD7606_CONFIG 0x02 // 配置寄存器 #define AD7606_CONVST 0x00 // 转换启动 #define AD7606_RANGE_5V 0x00 // ±5V输入范围 #define AD7606_RANGE_10V 0x01 // ±10V输入范围 // 多通道同时采样 uint16_t adc_data[8]; void multi_channel_sample(void) { // 启动转换 GPIO_SetBits(CONVST_PORT, CONVST_PIN); delay_us(1); GPIO_ResetBits(CONVST_PORT, CONVST_PIN); // 等待转换完成 while(GPIO_ReadInputDataBit(BUSY_PORT, BUSY_PIN)); // 读取8通道数据 for(int i = 0; i < 8; i++) { adc_data[i] = read_parallel_data(); } }