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