00001 /* Notice to developers: this file is intentionally included twice. */ 00002 00008 /* 00009 CONTENTS 00010 00011 1. Mechanical/Hardware 00012 2. Acceleration settings 00013 3. Pinouts 00014 4. Temperature sensors 00015 5. Heaters 00016 6. Communication options 00017 7. Miscellaneous 00018 8. Appendix A - PWMable pins and mappings 00019 */ 00020 00021 /***************************************************************************\ 00022 * * 00023 * 1. MECHANICAL/HARDWARE * 00024 * * 00025 \***************************************************************************/ 00026 00027 /* 00028 Set your microcontroller type in Makefile! atmega168/atmega328p/atmega644p/atmega1280 00029 00030 If you want to port this to a new chip, start off with arduino.h and see how you go. 00031 */ 00032 #ifndef __AVR_ATmega644P__ 00033 #error GEN6 has a 644P! set your cpu type in Makefile! 00034 #endif 00035 00039 #ifndef F_CPU 00040 #define F_CPU 16000000L 00041 #endif 00042 00046 #define HOST 00047 00048 /* 00049 Values reflecting the gearing of your machine. 00050 All numbers are fixed point integers, so no more than 3 digits to the right of the decimal point, please :-) 00051 */ 00052 00053 // calculate these values appropriate for your machine 00054 // for threaded rods, this is (steps motor per turn) / (pitch of the thread) 00055 // for belts, this is (steps per motor turn) / (number of gear teeth) / (belt module) 00056 // The GEN6 board uses 1/8 microstepping, so multiply your values by 8. 00057 #define STEPS_PER_MM_X (320.000*8) 00058 #define STEPS_PER_MM_Y (320.000*8) 00059 #define STEPS_PER_MM_Z (200.000*8) 00060 00062 #define STEPS_PER_MM_E (320.000*8) 00063 00064 00065 /* 00066 Values depending on the capabilities of your stepper motors and other mechanics. 00067 All numbers are integers, no decimals allowed. 00068 00069 Units are mm/min 00070 */ 00071 00073 #define MAXIMUM_FEEDRATE_X 200 00074 #define MAXIMUM_FEEDRATE_Y 200 00075 #define MAXIMUM_FEEDRATE_Z 100 00076 #define MAXIMUM_FEEDRATE_E 200 00077 00079 #define SEARCH_FEEDRATE_X 50 00080 #define SEARCH_FEEDRATE_Y 50 00081 #define SEARCH_FEEDRATE_Z 50 00082 #define SEARCH_FEEDRATE_E 50 00083 00085 #define E_STARTSTOP_STEPS 20 00086 00087 00093 #define X_MIN 0.0 00094 #define X_MAX 200.0 00095 00096 #define Y_MIN 0.0 00097 #define Y_MAX 200.0 00098 00099 #define Z_MIN 0.0 00100 #define Z_MAX 140.0 00101 00102 00103 00104 /***************************************************************************\ 00105 * * 00106 * 2. ACCELERATION * 00107 * * 00108 * IMPORTANT: choose only one! These algorithms choose when to step, trying * 00109 * to use more than one will have undefined and probably * 00110 * disastrous results! * 00111 * * 00112 \***************************************************************************/ 00113 00118 // #define ACCELERATION_REPRAP 00119 00124 #define ACCELERATION_RAMPING 00125 00129 #define ACCELERATION_STEEPNESS 500000 00130 00143 // #define ACCELERATION_TEMPORAL 00144 00145 00146 00147 /***************************************************************************\ 00148 * * 00149 * 3. PINOUTS * 00150 * * 00151 \***************************************************************************/ 00152 00153 /* 00154 Machine Pin Definitions 00155 - make sure to avoid duplicate usage of a pin 00156 - comment out pins not in use, as this drops the corresponding code and makes operations faster 00157 */ 00158 00159 #include "arduino.h" 00160 00165 //#define USE_INTERNAL_PULLUPS 00166 00167 /* 00168 this is the official GEN6 reprap motherboard pinout 00169 */ 00170 00171 #define X_STEP_PIN DIO15 00172 #define X_DIR_PIN DIO18 00173 #define X_MIN_PIN DIO20 00174 //#define X_MAX_PIN xxxx 00175 #define X_ENABLE_PIN DIO19 00176 //#define X_INVERT_DIR 00177 //#define X_INVERT_MIN 00178 //#define X_INVERT_MAX 00179 //#define X_INVERT_ENABLE 00180 00181 #define Y_STEP_PIN DIO23 00182 #define Y_DIR_PIN DIO22 00183 #define Y_MIN_PIN DIO25 00184 //#define Y_MAX_PIN xxxx 00185 #define Y_ENABLE_PIN DIO24 00186 //#define Y_INVERT_DIR 00187 //#define Y_INVERT_MIN 00188 //#define Y_INVERT_MAX 00189 //#define Y_INVERT_ENABLE 00190 00191 #define Z_STEP_PIN DIO27 00192 #define Z_DIR_PIN DIO28 00193 #define Z_MIN_PIN DIO30 00194 //#define Z_MAX_PIN xxxx 00195 #define Z_ENABLE_PIN DIO29 00196 //#define Z_INVERT_DIR 00197 //#define Z_INVERT_MIN 00198 //#define Z_INVERT_MAX 00199 //#define Z_INVERT_ENABLE 00200 00201 #define E_STEP_PIN DIO4 00202 #define E_DIR_PIN DIO2 00203 #define E_ENABLE_PIN DIO3 00204 //#define E_INVERT_DIR 00205 00206 00207 00208 /***************************************************************************\ 00209 * * 00210 * 4. TEMPERATURE SENSORS * 00211 * * 00212 \***************************************************************************/ 00213 00218 #define TEMP_HYSTERESIS 20 00219 00224 #define TEMP_RESIDENCY_TIME 60 00225 00227 // #define TEMP_MAX6675 00228 #define TEMP_THERMISTOR 00229 // #define TEMP_AD595 00230 // #define TEMP_PT100 00231 // #define TEMP_INTERCOM 00232 00233 /***************************************************************************\ 00234 * * 00235 * Define your temperature sensors here * 00236 * * 00237 * If your temperature sensor has no associated heater, enter '255' as the * 00238 * heater index. Unassociated temperature sensors are still read, but they * 00239 * do not affect firmware operation * 00240 * * 00241 * Types are same as TEMP_ list above- TT_MAX6675, TT_THERMISTOR, TT_AD595, * 00242 * TT_PT100, TT_INTERCOM. See list in temp.c. * 00243 * * 00244 \***************************************************************************/ 00245 00246 #ifndef DEFINE_TEMP_SENSOR 00247 #define DEFINE_TEMP_SENSOR(...) 00248 #endif 00249 00250 // name type pin 00251 DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, PINA5) 00252 00253 00254 00255 /***************************************************************************\ 00256 * * 00257 * 5. HEATERS * 00258 * * 00259 \***************************************************************************/ 00260 00261 00265 // #define HEATER_SANITY_CHECK 00266 00267 /***************************************************************************\ 00268 * * 00269 * Define your heaters here * 00270 * * 00271 * If your heater isn't on a PWM-able pin, set heater_pwm to zero and we'll * 00272 * use bang-bang output. Note that PID will still be used * 00273 * * 00274 * See Appendix 8 at the end of this file for PWMable pin mappings * 00275 * * 00276 * If a heater isn't attached to a temperature sensor above, it can still be * 00277 * controlled by host but otherwise is ignored by firmware * 00278 * * 00279 * To attach a heater to a temp sensor above, simply use exactly the same * 00280 * name - copy+paste is your friend * 00281 * * 00282 * Some common names are 'extruder', 'bed', 'fan', 'motor' * 00283 * * 00284 \***************************************************************************/ 00285 00286 #ifndef DEFINE_HEATER 00287 #define DEFINE_HEATER(...) 00288 #endif 00289 00290 // name port pin pwm 00291 DEFINE_HEATER(extruder, PORTD, PIND6, OCR2B) 00292 00293 00294 00295 00296 00297 00298 00299 #define HEATER_EXTRUDER HEATER_extruder 00300 // #define HEATER_BED HEATER_bed 00301 // #define HEATER_FAN HEATER_fan 00302 00303 00304 00305 /***************************************************************************\ 00306 * * 00307 * 6. COMMUNICATION OPTIONS * 00308 * * 00309 \***************************************************************************/ 00310 00317 // #define REPRAP_HOST_COMPATIBILITY 19750101 00318 #define REPRAP_HOST_COMPATIBILITY 20100806 00319 // #define REPRAP_HOST_COMPATIBILITY <date of next RepRap Host compatibility break> 00320 00324 #define BAUD 115200 00325 00331 // #define XONXOFF 00332 00333 00334 00335 /***************************************************************************\ 00336 * * 00337 * 7. MISCELLANEOUS OPTIONS * 00338 * * 00339 \***************************************************************************/ 00340 00347 // #define DEBUG 00348 00354 // #define BANG_BANG 00359 // #define BANG_BANG_ON 200 00364 // #define BANG_BANG_OFF 45 00365 00371 #define MOVEBUFFER_SIZE 8 00372 00377 // #define DC_EXTRUDER HEATER_motor 00378 // #define DC_EXTRUDER_PWM 180 00379 00383 // #define USE_WATCHDOG 00384 00385 /* 00386 analog subsystem stuff 00387 REFERENCE - which analog reference to use. see analog.h for choices 00388 */ 00389 #define REFERENCE REFERENCE_AVCC 00390 00395 #define STEP_INTERRUPT_INTERRUPTIBLE 1 00396 00397 /* 00398 temperature history count. This is how many temperature readings to keep in order to calculate derivative in PID loop 00399 higher values make PID derivative term more stable at the expense of reaction time 00400 */ 00401 #define TH_COUNT 8 00402 00403 // this is the scaling of internally stored PID values. 1024L is a good value 00404 #define PID_SCALE 1024L 00405 00406 00407 00408 /***************************************************************************\ 00409 * * 00410 * 8. APPENDIX A - PWMABLE PINS AND MAPPINGS * 00411 * * 00412 * * 00413 * list of PWM-able pins and corresponding timers * 00414 * timer1 is used for step timing so don't use OC1A/OC1B * 00415 * they are omitted from this listing for that reason * 00416 * * 00417 * For the atmega168/328, timer/pin mappings are as follows * 00418 * * 00419 * OCR0A - PD6 - DIO6 * 00420 * OCR0B - PD5 - DIO5 * 00421 * OCR2A - PB3 - DIO11 * 00422 * OCR2B - PD3 - DIO3 * 00423 * * 00424 * For the atmega644, timer/pin mappings are as follows * 00425 * * 00426 * OCR0A - PB3 - DIO3 * 00427 * OCR0B - PB4 - DIO4 * 00428 * OCR2A - PD7 - DIO15 * 00429 * OCR2B - PD6 - DIO14 * 00430 * * 00431 * For the atmega1280, timer/pin mappings are as follows * 00432 * * 00433 * OCR0A - PB7 - DIO13 * 00434 * OCR0B - PG5 - DIO4 * 00435 * OCR2A - PB4 - DIO10 * 00436 * OCR2B - PH6 - DIO9 * 00437 * OCR3AL - PE3 - DIO5 * 00438 * OCR3BL - PE4 - DIO2 * 00439 * OCR3CL - PE5 - DIO3 * 00440 * OCR4AL - PH3 - DIO6 * 00441 * OCR4BL - PH4 - DIO7 * 00442 * OCR4CL - PH5 - DIO8 * 00443 * OCR5AL - PL3 - DIO46 * 00444 * OCR5BL - PL4 - DIO45 * 00445 * OCR5CL - PL5 - DIO44 * 00446 * * 00447 \***************************************************************************/