PageRenderTime 54ms CodeModel.GetById 28ms RepoModel.GetById 1ms app.codeStats 0ms

/FiveD_GCode/FiveD_GCode_Interpreter/Temperature.h

https://github.com/kartenkarsten/firmware
C Header | 343 lines | 171 code | 47 blank | 125 comment | 29 complexity | 42a0c59dabbd7dbbe90e702fc2a40ab1 MD5 | raw file
  1. #ifndef TEMPERATURE_H
  2. #define TEMPERATURE_H
  3. // HINT: To decide which Thermistor/s are used, you no longer need to change this file!
  4. // please just change the two definitions in your configuration.h file that are:
  5. // TEMP_SENSOR ( choose what to set it to based on the options in features.h )
  6. // BED_TEMP_SENSOR ( as per above, or leave it unset, and it will automatically be set the same as TEMP_SENSOR )
  7. //
  8. // Developers please note: the "Tables" defined in this .h file are arbitrarily identified by unique prefixes
  9. // such as a_ and b_, etc. this is so that you can use a different temperature table for your extruder
  10. // and your heated bed. ( or perhaps use a thermocouple of one, and a thermistor on the other ).
  11. // If you add your own "Table", please give it a unique prefix, following the existing conventions below
  12. // ( and update setupThermistors() function too )
  13. // The temperature control dead zone in deg C
  14. #define HALF_DEAD_ZONE 5
  15. // ie max6675 or AD595 or similar we just declare a dummy :
  16. #ifndef USE_THERMISTOR
  17. short temptable[0][2] = { };
  18. short bedtemptable[0][2] = { };
  19. #endif
  20. // now we can ignore the rest of this file unless we are using a thermistor somewhere!
  21. #ifdef USE_THERMISTOR
  22. // theoretically we could change this number on a per-thermistor basis,
  23. //but in reality this is a fixed constant that applies to both thermistor/s you use.
  24. #define NUMTEMPS 20
  25. // convenience typedefs
  26. typedef short Pair[2];
  27. typedef Pair Table[NUMTEMPS];
  28. // for direct PIC temperature control of the extruder without a separate extruder CPU, we define the
  29. // thermistor table/s we want to use in this file.
  30. #if ( EXTRUDER_CONTROLLER == EXTRUDER_CONTROLLER_INTERNAL ) || ( EXTRUDER_CONTROLLER == EXTRUDER_CONTROLLER_DC )
  31. Pair *temptable; // a pointer to the first "Pair" is equivalient to a "Table" type, but conveniently modifiable.
  32. #endif
  33. // ... And this is the heated bed thermistor (if any)
  34. #if HEATED_BED == HEATED_BED_ON
  35. Pair *bedtemptable;
  36. #endif
  37. // using "Jaycar 125deg 10k thermistor" and 4.7k R ( not temperature rated for extruder/s, heated bed only)
  38. #if TEMP_SENSOR == TEMP_JAYCAR_NTC_125DEG_10K_THERMISTOR || BED_TEMP_SENSOR == TEMP_JAYCAR_NTC_125DEG_10K_THERMISTOR
  39. Table a_temptable = {
  40. {1, 599},
  41. {40, 130},
  42. {60, 120},
  43. {81, 110},
  44. {106, 100},
  45. {133, 90},
  46. {177, 80},
  47. {235, 70},
  48. {295, 60},
  49. {346, 55},
  50. {373, 50},
  51. {309, 45},
  52. {451, 43},
  53. {490, 37},
  54. {637, 31},
  55. {690, 25},
  56. {743, 19},
  57. {796, 12},
  58. {849, 5},
  59. {999, 0}
  60. };
  61. #endif
  62. // "RS 10k thermistor" RS Part: 484-0149; EPCOS B57550G103J
  63. // Made with createTemperatureLookup.py (http://svn.reprap.org/trunk/reprap/firmware/Arduino/utilities/createTemperatureLookup.py)
  64. // ./createTemperatureLookup.py --r0=10000 --t0=25 --r1=0 --r2=4700 --beta=3480 --max-adc=1023
  65. // r0: 10000
  66. // t0: 25
  67. // r1: 0
  68. // r2: 4700
  69. // beta: 3480
  70. // max adc: 1023
  71. #if TEMP_SENSOR == TEMP_SENSOR_RS10K_THERMISTOR || BED_TEMP_SENSOR == TEMP_SENSOR_RS10K_THERMISTOR
  72. Table b_temptable = {
  73. {1, 599},
  74. {54, 160},
  75. {107, 123},
  76. {160, 103},
  77. {213, 90},
  78. {266, 79},
  79. {319, 70},
  80. {372, 62},
  81. {425, 55},
  82. {478, 49},
  83. {531, 43},
  84. {584, 37},
  85. {637, 31},
  86. {690, 25},
  87. {743, 19},
  88. {796, 12},
  89. {849, 5},
  90. {902, -3},
  91. {955, -16},
  92. {1008, -42}
  93. };
  94. #endif
  95. // "RS 100k thermistor" Rs Part: 528-8592; "EPCOS NTC G540" B57540G0104J
  96. // ./createTemperatureLookup.py --r0=100000 --t0=25 --r1=0 --r2=4700 --beta=4036 --max-adc=1023
  97. // r0: 100000
  98. // t0: 25
  99. // r1: 0
  100. // r2: 4700
  101. // beta: 4036
  102. // max adc: 1023
  103. #if TEMP_SENSOR == TEMP_SENSOR_EPCOS540_THERMISTOR || BED_TEMP_SENSOR == TEMP_SENSOR_EPCOS540_THERMISTOR
  104. Table c_temptable = {
  105. {1, 864},
  106. {54, 258},
  107. {107, 211},
  108. {160, 185},
  109. {213, 168},
  110. {266, 154},
  111. {319, 143},
  112. {372, 133},
  113. {425, 125},
  114. {478, 116},
  115. {531, 109},
  116. {584, 101},
  117. {637, 94},
  118. {690, 87},
  119. {743, 79},
  120. {796, 70},
  121. {849, 61},
  122. {902, 50},
  123. {955, 34},
  124. {1008, 2}
  125. };
  126. #endif
  127. // RRRF 100K Thermistor
  128. // ./createTemperatureLookup.py --r0=100000 --t0=25 --r1=0 --r2=4700 --beta=3960 --max-adc=1023
  129. // r0: 100000
  130. // t0: 25
  131. // r1: 0
  132. // r2: 4700
  133. // beta: 3960
  134. // max adc: 1023
  135. #if TEMP_SENSOR == TEMP_SENSOR_RRRF100K_THERMISTOR || BED_TEMP_SENSOR == TEMP_SENSOR_RRRF100K_THERMISTOR
  136. Table d_temptable = {
  137. {1, 929},
  138. {54, 266},
  139. {107, 217},
  140. {160, 190},
  141. {213, 172},
  142. {266, 158},
  143. {319, 146},
  144. {372, 136},
  145. {425, 127},
  146. {478, 119},
  147. {531, 111},
  148. {584, 103},
  149. {637, 96},
  150. {690, 88},
  151. {743, 80},
  152. {796, 71},
  153. {849, 62},
  154. {902, 50},
  155. {955, 34},
  156. {1008, 2}
  157. };
  158. #endif
  159. // RRRF 10K Thermistor
  160. // ./createTemperatureLookup.py --r0=10000 --t0=25 --r1=680 --r2=1600 --beta=3964 --max-adc=305
  161. // r0: 10000
  162. // t0: 25
  163. // r1: 680
  164. // r2: 1600
  165. // beta: 3964
  166. // max adc: 305
  167. #if TEMP_SENSOR == TEMP_SENSOR_RRRF10K_THERMISTOR || BED_TEMP_SENSOR == TEMP_SENSOR_RRRF10K_THERMISTOR
  168. Table e_temptable = {
  169. {1, 601},
  170. {17, 260},
  171. {33, 213},
  172. {49, 187},
  173. {65, 170},
  174. {81, 156},
  175. {97, 144},
  176. {113, 134},
  177. {129, 125},
  178. {145, 117},
  179. {161, 109},
  180. {177, 101},
  181. {193, 94},
  182. {209, 86},
  183. {225, 78},
  184. {241, 69},
  185. {257, 59},
  186. {273, 46},
  187. {289, 28},
  188. {999, 0} // added to make NUMTEMPS 20 same as the others.
  189. };
  190. #endif
  191. // Farnell code for this thermistor: 882-9586
  192. // Made with createTemperatureLookup.py (http://svn.reprap.org/trunk/reprap/firmware/Arduino/utilities/createTemperatureLookup.py)
  193. // ./createTemperatureLookup.py --r0=100000 --t0=25 --r1=0 --r2=4700 --beta=4066 --max-adc=1023
  194. // r0: 100000
  195. // t0: 25
  196. // r1: 0
  197. // r2: 4700
  198. // beta: 4066
  199. // max adc: 1023
  200. //Developer note: does anyone have any accurate uptodate info on supplier/s of this part, please tell reprap-dev mailing list.
  201. /*
  202. Table temptable = {
  203. {1, 841},
  204. {54, 255},
  205. {107, 209},
  206. {160, 184},
  207. {213, 166},
  208. {266, 153},
  209. {319, 142},
  210. {372, 132},
  211. {425, 124},
  212. {478, 116},
  213. {531, 108},
  214. {584, 101},
  215. {637, 93},
  216. {690, 86},
  217. {743, 78},
  218. {796, 70},
  219. {849, 61},
  220. {902, 50},
  221. {955, 34},
  222. {1008, 3}
  223. };
  224. */
  225. // Farnell code for this thermistor: 882-9586
  226. // Made with createTemperatureLookup.py (http://svn.reprap.org/trunk/reprap/firmware/Arduino/utilities/createTemperatureLookup.py)
  227. // ./createTemperatureLookup.py --r0=100000 --t0=25 --r1=0 --r2=4700 --beta=4066 --max-adc=1023
  228. // r0: 100000
  229. // t0: 25
  230. // r1: 0
  231. // r2: 4700
  232. // beta: 4066
  233. // max adc: 1023
  234. //Developer note: does anyone have any accurate uptodate info on supplier/s of this part, please tell reprap-dev mailing list.
  235. /*
  236. Table temptable = {
  237. {1, 841},
  238. {54, 255},
  239. {107, 209},
  240. {160, 184},
  241. {213, 166},
  242. {266, 153},
  243. {319, 142},
  244. {372, 132},
  245. {425, 124},
  246. {478, 116},
  247. {531, 108},
  248. {584, 101},
  249. {637, 93},
  250. {690, 86},
  251. {743, 78},
  252. {796, 70},
  253. {849, 61},
  254. {902, 50},
  255. {955, 34},
  256. {1008, 3}
  257. };
  258. */
  259. // * Other thermistors...
  260. // See this page:
  261. // http://www.reprap.org/wiki/Thermistor
  262. // for details of what goes in this table, and how to make your own.
  263. #endif //USE_THERMISTOR
  264. void setupThermistors() {
  265. #if TEMP_SENSOR == TEMP_JAYCAR_NTC_125DEG_10K_THERMISTOR
  266. temptable = &a_temptable[0];
  267. #endif
  268. #if BED_TEMP_SENSOR == TEMP_JAYCAR_NTC_125DEG_10K_THERMISTOR
  269. bedtemptable = &a_temptable[0];
  270. #endif
  271. #if TEMP_SENSOR == TEMP_SENSOR_RS10K_THERMISTOR
  272. temptable = &b_temptable[0];
  273. #endif
  274. #if BED_TEMP_SENSOR == TEMP_SENSOR_RS10K_THERMISTOR
  275. bedtemptable = &b_temptable[0];
  276. #endif
  277. #if TEMP_SENSOR == TEMP_SENSOR_EPCOS540_THERMISTOR
  278. temptable = &c_temptable[0];
  279. #endif
  280. #if BED_TEMP_SENSOR == TEMP_SENSOR_EPCOS540_THERMISTOR
  281. bedtemptable = &c_temptable[0];
  282. #endif
  283. #if TEMP_SENSOR == TEMP_SENSOR_RRRF100K_THERMISTOR
  284. temptable = &d_temptable[0];
  285. #endif
  286. #if BED_TEMP_SENSOR == TEMP_SENSOR_RRRF100K_THERMISTOR
  287. bedtemptable = &d_temptable[0];
  288. #endif
  289. #if TEMP_SENSOR == TEMP_SENSOR_RRRF10K_THERMISTOR
  290. temptable = &e_temptable[0];
  291. #endif
  292. #if BED_TEMP_SENSOR == TEMP_SENSOR_RRRF10K_THERMISTOR
  293. bedtemptable = &e_temptable[0];
  294. #endif
  295. }
  296. #endif