Other Parts Discussed in Thread: TDC7200
Tool/software: Code Composer Studio
Hello,
I am trying to sample and convert both RTD1 and RTD2 temperature values with the following code (tdc7200_calculation.c):
void print_start2stopn(void)
{
if ((start2stop[2]-start2stop[1]) < 20000){ // If (stop2 to stop3 (ns) < 20000), use (stop2 to stop4 (ns)). Else: use (stop2 to stop3 (ns)) in RTD1 calculation.
rtd1 = 0.26*((start2stop[0]*1000.0/(start2stop[3]-start2stop[1]))-1000.0); // 0.26 is PT1000 conversion factor
// (rtd2 problem here)
}
else{
rtd1 = 0.26*((start2stop[0]*1000.0/(start2stop[2]-start2stop[1]))-1000.0);
}
rtd2 = 0.26*((start2stop[0]*1000.0/(start2stop[4]-start2stop[3]))-1000.0);
sprintf((char *)outString, "A%.6fsB%.6f\n",rtd1,rtd2); // output rtd1 and rtd2 temp. values
putsUART((unsigned char *)outString,strlen((char *)outString));
}
RTD1 values are perfectly working. However when the if-statement is true, the rtd2 value gets totally wrong (usually ~80°C instead of ~20°C). How can I correctly calculate the RTD2 value?
Thanks in advance!
Regards,
Thibault