libraries/TypeK/TypeK.cpp
// ---------------- returns mV corresponding to temp reading
//                  used for cold junction compensation

returns mV corresponding to temp reading
used for cold junction compensation
returns mV corresponding to temp reading used for cold junction compensation
double TypeK::mV_C( float ambC ) {
  double sum = 0.0;
  double x = 1.0;
  float sum2 = 0.0;
  int i;
  if( !inrange_C( ambC ) ) return TC_RANGE_ERR;
  if( (ambC >= range_dir[0][0]) && ( ambC <= range_dir[1][0] ) ) {
    for( i = 0; i < 11; i++ ) {
      sum += x * coeff_dir[i][0];
      x *= ambC;
    } 
  }
  else {
    for( i = 0; i < 10; i++ ) {
      sum += x * coeff_dir[i][1];
      x *= ambC;    
    };
    sum2 = a[0] * exp( a[1] * ( ambC - a[2] ) * ( ambC - a[2] ) );
    sum += sum2;
  };  
  return sum;
}
double TypeK :: mV_C ( float ambC ) { double sum = 0.0 ; double x = 1.0 ; float sum2 = 0.0 ; int i ; if ( ! inrange_C ( ambC ) ) return TC_RANGE_ERR ; if ( ( ambC >= range_dir [ 0 ] [ 0 ] ) && ( ambC <= range_dir [ 1 ] [ 0 ] ) ) { for ( i = 0 ; i < 11 ; i ++ ) { sum += x * coeff_dir [ i ] [ 0 ] ; x *= ambC ; } } else { for ( i = 0 ; i < 10 ; i ++ ) { sum += x * coeff_dir [ i ] [ 1 ] ; x *= ambC ; } ; sum2 = a [ 0 ] * exp ( a [ 1 ] * ( ambC - a [ 2 ] ) * ( ambC - a [ 2 ] ) ) ; sum += sum2 ; } ; return sum ; }
returns mV corresponding to temp reading
used for cold junction compensation
returns mV corresponding to temp reading used for cold junction compensation
//    Serial.print( sum ); Serial.print(" , "); Serial.println( sum2 );
