//设置CH0=VIN6-VIN1 ADC_Write(CH0_INPUTCN, 0x31); //设置CH1=VIN1-VIN0 ADC_Write(CH1_INPUTCN, 0x08); //设置CH2=VIN6-VIN3 ADC_Write(CH2_INPUTCN, 0x32); //设置CH3=VIN3-VIN2 ADC_Write(CH3_INPUTCN, 0x1A); //设置CH4=VIN7-VIN5 ADC_Write(CH4_INPUTCN, 0x3D); //设置CH5=VIN5-VIN4 ADC_Write(CH5_INPUTCN, 0x2B); ADC_Write(CH0_CONFIG, 0x01); ADC_Write(CH1_CONFIG, 0x01); ADC_Write(CH2_CONFIG, 0x01); ADC_Write(CH3_CONFIG, 0x01); ADC_Write(CH4_CONFIG, 0x01); ADC_Write(CH5_CONFIG, 0x01); ADC_Write(BGCALCN, 0x02); //CH0-CH5 ADC_Write(CH_SCAN, 0xA8); //使用内部时钟,电流=1mA ADC_Write(ADC_AUXCN, 0x2A); float PT_100_J15(void) { uint16_t ADC_Convert[2] = {0}; float Temperature = 0, Resistance = 0; //CH0 delay_us(72); if(ADC_Read(ADC_DONE, 0x00) != 0xFF) { ADC_Convert[0] = ADC_Read_ADCOUT(); } //CH1 delay_us(72); if(ADC_Read(ADC_DONE, 0x00) != 0xFF) { ADC_Convert[1] = ADC_Read_ADCOUT(); } Resistance = ((ADC_Convert[0] - ADC_Convert[1]) * ( 3.0 / 32768)) * 1000.0; Temperature = 0.001 * pow(Resistance, 2) + 2.3625 * Resistance - 246.06; u1_printf("J15_Temperature:%f\r\n", Temperature); } float PT_100_J16(void) { uint16_t ADC_Convert[2] = {0}; float Temperature = 0, Resistance = 0; //CH2 delay_us(72); if(ADC_Read(ADC_DONE, 0x00) != 0xFF) { ADC_Convert[0] = ADC_Read_ADCOUT(); } //CH3 delay_us(72); if(ADC_Read(ADC_DONE, 0x00) != 0xFF) { ADC_Convert[1] = ADC_Read_ADCOUT(); } Resistance = ((ADC_Convert[0] - ADC_Convert[1]) * ( 3.0 / 32768)) * 1000.0; Temperature = 0.001 * pow(Resistance, 2) + 2.3625 * Resistance - 246.06; u1_printf("J16_Temperature:%f\r\n", Temperature); } float PT_100_J19(void) { uint16_t ADC_Convert[2] = {0}; float Temperature = 0, Resistance = 0; //CH4 delay_us(72); if(ADC_Read(ADC_DONE, 0x00) != 0xFF) { ADC_Convert[0] = ADC_Read_ADCOUT(); } //CH5 delay_us(72); if(ADC_Read(ADC_DONE, 0x00) != 0xFF) { ADC_Convert[1] = ADC_Read_ADCOUT(); } Resistance = ((ADC_Convert[0] - ADC_Convert[1]) * ( 3.0 / 32768)) * 1000.0; Temperature = 0.001 * pow(Resistance, 2) + 2.3625 * Resistance - 246.06; u1_printf("J19_Temperature:%f\r\n", Temperature); }当把PT100用三线制插在CH0和CH1的时候可以输出,把PT100插在CH2-CH5输出错误