00001 /* Notice to developers: this file is intentionally included twice. */ 00002 00009 /* 00010 CONTENTS 00011 00012 1. Mechanical/Hardware 00013 2. Acceleration settings 00014 3. Pinouts 00015 4. Temperature sensors 00016 5. Heaters 00017 6. Communication options 00018 7. Miscellaneous 00019 8. Appendix A - PWMable pins and mappings 00020 */ 00021 00022 /***************************************************************************\ 00023 * * 00024 * 1. MECHANICAL/HARDWARE * 00025 * * 00026 \***************************************************************************/ 00027 00028 /* 00029 Set your microcontroller type in Makefile! atmega168/atmega328p/atmega644p/atmega1280 00030 00031 If you want to port this to a new chip, start off with arduino.h and see how you go. 00032 */ 00033 00037 #ifndef F_CPU 00038 #define F_CPU 16000000UL 00039 #endif 00040 00044 #define HOST 00045 00046 /* 00047 Values reflecting the gearing of your machine. 00048 All numbers are fixed point integers, so no more than 3 digits to the right of the decimal point, please :-) 00049 */ 00050 00066 #define STEPS_PER_M_X 320000 00067 #define STEPS_PER_M_Y 320000 00068 #define STEPS_PER_M_Z 320000 00069 00071 #define STEPS_PER_M_E 320000 00072 00073 00074 /* 00075 Values depending on the capabilities of your stepper motors and other mechanics. 00076 All numbers are integers, no decimals allowed. 00077 00078 Units are mm/min 00079 */ 00080 00082 #define MAXIMUM_FEEDRATE_X 200 00083 #define MAXIMUM_FEEDRATE_Y 200 00084 #define MAXIMUM_FEEDRATE_Z 100 00085 #define MAXIMUM_FEEDRATE_E 200 00086 00088 #define SEARCH_FEEDRATE_X 50 00089 #define SEARCH_FEEDRATE_Y 50 00090 #define SEARCH_FEEDRATE_Z 50 00091 // no SEARCH_FEEDRATE_E, as E can't be searched 00092 00097 // #define SLOW_HOMING 00098 00100 #define E_STARTSTOP_STEPS 20 00101 00107 //#define X_MIN 0.0 00108 //#define X_MAX 200.0 00109 00110 //#define Y_MIN 0.0 00111 //#define Y_MAX 200.0 00112 00113 //#define Z_MIN 0.0 00114 //#define Z_MAX 140.0 00115 00121 // #define E_ABSOLUTE 00122 00123 00124 00125 /***************************************************************************\ 00126 * * 00127 * 2. ACCELERATION * 00128 * * 00129 * IMPORTANT: choose only one! These algorithms choose when to step, trying * 00130 * to use more than one will have undefined and probably * 00131 * disastrous results! * 00132 * * 00133 \***************************************************************************/ 00134 00139 // #define ACCELERATION_REPRAP 00140 00145 #define ACCELERATION_RAMPING 00146 00151 #define ACCELERATION 1000. 00152 00165 // #define ACCELERATION_TEMPORAL 00166 00167 00168 00169 /***************************************************************************\ 00170 * * 00171 * 3. PINOUTS * 00172 * * 00173 \***************************************************************************/ 00174 00175 /* 00176 Machine Pin Definitions 00177 - make sure to avoid duplicate usage of a pin 00178 - comment out pins not in use, as this drops the corresponding code and makes operations faster 00179 */ 00180 00181 #include "arduino.h" 00182 00187 //#define USE_INTERNAL_PULLUPS 00188 00189 /* 00190 user defined pins 00191 adjust to suit your electronics, 00192 or adjust your electronics to suit this 00193 */ 00194 00195 #define X_STEP_PIN AIO0 00196 #define X_DIR_PIN AIO1 00197 #define X_MIN_PIN AIO2 00198 //#define X_MAX_PIN xxxx 00199 //#define X_ENABLE_PIN xxxx 00200 //#define X_INVERT_DIR 00201 //#define X_INVERT_MIN 00202 //#define X_INVERT_MAX 00203 //#define X_INVERT_ENABLE 00204 00205 #define Y_STEP_PIN AIO3 00206 #define Y_DIR_PIN AIO4 00207 #define Y_MIN_PIN AIO5 00208 //#define Y_MAX_PIN xxxx 00209 //#define Y_ENABLE_PIN xxxx 00210 //#define Y_INVERT_DIR 00211 //#define Y_INVERT_MIN 00212 //#define Y_INVERT_MAX 00213 //#define Y_INVERT_ENABLE 00214 00215 #define Z_STEP_PIN DIO2 00216 #define Z_DIR_PIN DIO3 00217 #define Z_MIN_PIN DIO4 00218 //#define Z_MAX_PIN xxxx 00219 //#define Z_ENABLE_PIN xxxx 00220 //#define Z_INVERT_DIR 00221 //#define Z_INVERT_MIN 00222 //#define Z_INVERT_MAX 00223 //#define Z_INVERT_ENABLE 00224 00225 #define E_STEP_PIN DIO7 00226 #define E_DIR_PIN DIO8 00227 //#define E_ENABLE_PIN xxxx 00228 //#define E_INVERT_DIR 00229 //#define E_INVERT_ENABLE 00230 00231 #define PS_ON_PIN DIO9 00232 //#define STEPPER_ENABLE_PIN xxxx 00233 //#define STEPPER_INVERT_ENABLE 00234 00235 00236 00237 /***************************************************************************\ 00238 * * 00239 * 4. TEMPERATURE SENSORS * 00240 * * 00241 \***************************************************************************/ 00242 00247 #define TEMP_HYSTERESIS 5 00248 00253 #define TEMP_RESIDENCY_TIME 60 00254 00256 // #define TEMP_MAX6675 00257 #define TEMP_THERMISTOR 00258 // #define TEMP_AD595 00259 // #define TEMP_PT100 00260 // #define TEMP_INTERCOM 00261 // #define TEMP_NONE 00262 00263 /***************************************************************************\ 00264 * * 00265 * Define your temperature sensors here. One line for each sensor, only * 00266 * limited by the number of available ATmega pins. * 00267 * * 00268 * For a GEN3 set temp_type to TT_INTERCOM and temp_pin to 0. * 00269 * * 00270 * Types are same as TEMP_ list above - TT_MAX6675, TT_THERMISTOR, TT_AD595, * 00271 * TT_PT100, TT_INTERCOM, TT_NONE. See list in temp.c. * 00272 * * 00273 * The "additional" field is used for TT_THERMISTOR only. It defines the * 00274 * name of the table(s) in ThermistorTable.h to use. Typically, this is * 00275 * THERMISTOR_EXTRUDER for the first or only table, or THERMISTOR_BED for * 00276 * the second table. See also early in ThermistorTable.{single|double}.h. * 00277 * * 00278 \***************************************************************************/ 00279 00280 #ifndef DEFINE_TEMP_SENSOR 00281 #define DEFINE_TEMP_SENSOR(...) 00282 #endif 00283 00284 // name type pin additional 00285 DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, 0, THERMISTOR_EXTRUDER) 00286 DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, 1, THERMISTOR_EXTRUDER) 00287 // "noheater" is a special name for a sensor which doesn't have a heater. 00288 // Use "M105 P#" to read it, where # is a zero-based index into this list. 00289 // DEFINE_TEMP_SENSOR(noheater, TT_THERMISTOR, 1, 0) 00290 00291 00292 00293 /***************************************************************************\ 00294 * * 00295 * 5. HEATERS * 00296 * * 00297 \***************************************************************************/ 00298 00303 // #define HEATER_SANITY_CHECK 00304 00305 /***************************************************************************\ 00306 * * 00307 * Define your heaters here * 00308 * * 00309 * If your heater isn't on a PWM-able pin, set heater_pwm to zero and we'll * 00310 * use bang-bang output. Note that PID will still be used * 00311 * * 00312 * See Appendix 8 at the end of this file for PWMable pin mappings * 00313 * * 00314 * If a heater isn't attached to a temperature sensor above, it can still be * 00315 * controlled by host but otherwise is ignored by firmware * 00316 * * 00317 * To attach a heater to a temp sensor above, simply use exactly the same * 00318 * name - copy+paste is your friend * 00319 * * 00320 * Some common names are 'extruder', 'bed', 'fan', 'motor' * 00321 * * 00322 * A milling spindle can also be defined as a heater. Attach it to a * 00323 * temperature sensor of TT_NONE, then you can control the spindle's rpm * 00324 * via temperature commands. M104 S1..255 for spindle on, M104 S0 for off. * 00325 * * 00326 \***************************************************************************/ 00327 00328 #ifndef DEFINE_HEATER 00329 #define DEFINE_HEATER(...) 00330 #endif 00331 00332 // name port 00333 DEFINE_HEATER(extruder, PB3) 00334 DEFINE_HEATER(bed, PB4) 00335 // DEFINE_HEATER(fan, PINB4) 00336 // DEFINE_HEATER(chamber, PIND7) 00337 // DEFINE_HEATER(motor, PIND6) 00338 00344 00345 #define HEATER_EXTRUDER HEATER_extruder 00346 #define HEATER_BED HEATER_bed 00347 // #define HEATER_FAN HEATER_fan 00348 // #define HEATER_CHAMBER HEATER_chamber 00349 // #define HEATER_MOTOR HEATER_motor 00350 00351 00352 00353 /***************************************************************************\ 00354 * * 00355 * 6. COMMUNICATION OPTIONS * 00356 * * 00357 \***************************************************************************/ 00358 00365 // #define REPRAP_HOST_COMPATIBILITY 19750101 00366 // #define REPRAP_HOST_COMPATIBILITY 20100806 00367 // #define REPRAP_HOST_COMPATIBILITY 20110509 00368 // #define REPRAP_HOST_COMPATIBILITY <date of next RepRap Host compatibility break> 00369 00373 #define BAUD 115200 00374 00380 // #define XONXOFF 00381 00382 00383 00384 /***************************************************************************\ 00385 * * 00386 * 7. MISCELLANEOUS OPTIONS * 00387 * * 00388 \***************************************************************************/ 00389 00396 // #define DEBUG 00397 00403 // #define BANG_BANG 00408 // #define BANG_BANG_ON 200 00413 // #define BANG_BANG_OFF 45 00414 00420 #define MOVEBUFFER_SIZE 8 00421 00426 // #define DC_EXTRUDER HEATER_motor 00427 // #define DC_EXTRUDER_PWM 180 00428 00432 // #define USE_WATCHDOG 00433 00438 #define REFERENCE REFERENCE_AVCC 00439 00445 #define STEP_INTERRUPT_INTERRUPTIBLE 1 00446 00451 #define TH_COUNT 8 00452 00458 #define FAST_PWM 00459 00461 #define PID_SCALE 1024L 00462 00467 #define ENDSTOP_STEPS 4 00468 00469 00470 00471 /***************************************************************************\ 00472 * * 00473 * 8. APPENDIX A - PWMABLE PINS AND MAPPINGS * 00474 * * 00475 * * 00476 * list of PWM-able pins and corresponding timers * 00477 * timer1 is used for step timing so don't use OC1A/OC1B * 00478 * they are omitted from this listing for that reason * 00479 * * 00480 * For the atmega168/328, timer/pin mappings are as follows * 00481 * * 00482 * OCR0A - PD6 - DIO6 * 00483 * OCR0B - PD5 - DIO5 * 00484 * OCR2A - PB3 - DIO11 * 00485 * OCR2B - PD3 - DIO3 * 00486 * * 00487 * For the atmega644, timer/pin mappings are as follows * 00488 * * 00489 * OCR0A - PB3 - DIO3 * 00490 * OCR0B - PB4 - DIO4 * 00491 * OCR2A - PD7 - DIO15 * 00492 * OCR2B - PD6 - DIO14 * 00493 * * 00494 * For the atmega1280, timer/pin mappings are as follows * 00495 * * 00496 * OCR0A - PB7 - DIO13 * 00497 * OCR0B - PG5 - DIO4 * 00498 * OCR2A - PB4 - DIO10 * 00499 * OCR2B - PH6 - DIO9 * 00500 * OCR3AL - PE3 - DIO5 * 00501 * OCR3BL - PE4 - DIO2 * 00502 * OCR3CL - PE5 - DIO3 * 00503 * OCR4AL - PH3 - DIO6 * 00504 * OCR4BL - PH4 - DIO7 * 00505 * OCR4CL - PH5 - DIO8 * 00506 * OCR5AL - PL3 - DIO46 * 00507 * OCR5BL - PL4 - DIO45 * 00508 * OCR5CL - PL5 - DIO44 * 00509 * * 00510 \***************************************************************************/