-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ntc.c
70 lines (57 loc) · 1.79 KB
/
ntc.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* ******************************************************************************
* VSCP (Very Simple Control Protocol)
* http://www.vscp.org
*
* Kelvin NTC10KA Module
* =====================
*
* Copyright (C) 2015-2020 Ake Hedman, Grodans Paradis AB
* http://www.grodansparadis.com
* <akhe@grodansparadis.com>
*
* This work is licensed under the Creative Common
* Attribution-NonCommercial-ShareAlike 3.0 Unported license. The full
* license is available in the top folder of this project (LICENSE) or here
* http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode
* It is also available in a human readable form here
* http://creativecommons.org/licenses/by-nc-sa/3.0/
*
* This file is part of VSCP - Very Simple Control Protocol
* http://www.vscp.org
*
* ******************************************************************************
*/
#include "vscp_compiler.h"
#include "vscp_projdefs.h"
#include <p18cxxx.h>
#include <float.h>
#include <math.h>
#include "ntc.h"
///////////////////////////////////////////////////////////////////////////////
// Celsius2Fahrenheit
//
double Celsius2Fahrenheit(double tc)
{
return ( (9 * tc + 16000) / 5);
}
///////////////////////////////////////////////////////////////////////////////
// Fahrenheit2Celsius
//
double Fahrenheit2Celsius(double tf)
{
return ( (5 * tf - 16000) / 9);
}
///////////////////////////////////////////////////////////////////////////////
// Celsius2Kelvin
//
double Celsius2Kelvin(double tc)
{
return (27316.0 + tc);
}
///////////////////////////////////////////////////////////////////////////////
// Kelvin2Celsius
//
double Kelvin2Celsius(double tf)
{
return ( tf - 273.16);
}