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 #if ! ( defined (__AVR_ATmega1280__) || defined (__AVR_ATmega2560__) ) 00033 #error RAMPS has 1280/2560! 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 // half-stepping doubles the number, quarter stepping requires * 4, etc. 00057 #define MICROSTEPPING_X 16.0 00058 #define MICROSTEPPING_Y 16.0 00059 #define MICROSTEPPING_Z 16.0 00060 #define MICROSTEPPING_E 4.0 00061 00062 #define STEPS_PER_MM_X (5.023*MICROSTEPPING_X) 00063 #define STEPS_PER_MM_Y (5.023*MICROSTEPPING_Y) 00064 #define STEPS_PER_MM_Z (416.699*MICROSTEPPING_Z) 00065 00067 #define STEPS_PER_MM_E (2.759*MICROSTEPPING_E) 00068 00069 00070 /* 00071 Values depending on the capabilities of your stepper motors and other mechanics. 00072 All numbers are integers, no decimals allowed. 00073 00074 Units are mm/min 00075 */ 00076 00078 #define MAXIMUM_FEEDRATE_X 200 00079 #define MAXIMUM_FEEDRATE_Y 200 00080 #define MAXIMUM_FEEDRATE_Z 100 00081 #define MAXIMUM_FEEDRATE_E 600 00082 00084 #define SEARCH_FEEDRATE_X 50 00085 #define SEARCH_FEEDRATE_Y 50 00086 #define SEARCH_FEEDRATE_Z 1 00087 #define SEARCH_FEEDRATE_E 50 00088 00090 #define E_STARTSTOP_STEPS 0 00091 00092 00098 #define X_MIN 0.0 00099 #define X_MAX 200.0 00100 00101 #define Y_MIN 0.0 00102 #define Y_MAX 200.0 00103 00104 #define Z_MIN 0.0 00105 #define Z_MAX 140.0 00106 00107 00108 00109 /***************************************************************************\ 00110 * * 00111 * 2. ACCELERATION * 00112 * * 00113 * IMPORTANT: choose only one! These algorithms choose when to step, trying * 00114 * to use more than one will have undefined and probably * 00115 * disastrous results! * 00116 * * 00117 \***************************************************************************/ 00118 00123 // #define ACCELERATION_REPRAP 00124 00129 #define ACCELERATION_RAMPING 00130 00134 #define ACCELERATION_STEEPNESS 500000 00135 00148 // #define ACCELERATION_TEMPORAL 00149 00150 00151 00152 /***************************************************************************\ 00153 * * 00154 * 3. PINOUTS * 00155 * * 00156 \***************************************************************************/ 00157 00158 /* 00159 Machine Pin Definitions 00160 - make sure to avoid duplicate usage of a pin 00161 - comment out pins not in use, as this drops the corresponding code and makes operations faster 00162 */ 00163 00164 #include "arduino.h" 00165 00170 //#define USE_INTERNAL_PULLUPS 00171 00172 /* 00173 this is the ramps motherboard pinout 00174 */ 00175 00176 //#define TX_ENABLE_PIN DIO12 00177 //#define RX_ENABLE_PIN DIO13 00178 00179 #define X_STEP_PIN DIO26 00180 #define X_DIR_PIN DIO28 00181 #define X_MIN_PIN DIO3 00182 #define X_MAX_PIN DIO2 00183 #define X_ENABLE_PIN DIO24 00184 //#define X_INVERT_DIR 00185 //#define X_INVERT_MIN 00186 //#define X_INVERT_MAX 00187 //#define X_INVERT_ENABLE 00188 00189 #define Y_STEP_PIN DIO38 00190 #define Y_DIR_PIN DIO40 00191 #define Y_MIN_PIN DIO16 00192 #define Y_MAX_PIN DIO17 00193 #define Y_ENABLE_PIN DIO36 00194 //#define Y_INVERT_DIR 00195 //#define Y_INVERT_MIN 00196 //#define Y_INVERT_MAX 00197 //#define Y_INVERT_ENABLE 00198 00199 #define Z_STEP_PIN DIO44 00200 #define Z_DIR_PIN DIO46 00201 #define Z_MIN_PIN DIO18 00202 #define Z_MAX_PIN DIO19 00203 #define Z_ENABLE_PIN DIO42 00204 //#define Z_INVERT_DIR 00205 //#define Z_INVERT_MIN 00206 //#define Z_INVERT_MAX 00207 //#define Z_INVERT_ENABLE 00208 00209 #define E_STEP_PIN DIO32 00210 #define E_DIR_PIN DIO34 00211 #define E_ENABLE_PIN DIO30 00212 //#define E_INVERT_DIR 00213 00214 //#define SD_CARD_DETECT DIO2 00215 //#define SD_WRITE_PROTECT DIO3 00216 00217 00218 00219 /***************************************************************************\ 00220 * * 00221 * 4. TEMPERATURE SENSORS * 00222 * * 00223 \***************************************************************************/ 00224 00229 #define TEMP_HYSTERESIS 20 00230 00235 #define TEMP_RESIDENCY_TIME 60 00236 00238 // #define TEMP_MAX6675 00239 #define TEMP_THERMISTOR 00240 // #define TEMP_AD595 00241 // #define TEMP_PT100 00242 // #define TEMP_INTERCOM 00243 00244 /***************************************************************************\ 00245 * * 00246 * Define your temperature sensors here * 00247 * * 00248 * for GEN3 set temp_type to TT_INTERCOM and temp_pin to 0 * 00249 * * 00250 * Types are same as TEMP_ list above- TT_MAX6675, TT_THERMISTOR, TT_AD595, * 00251 * TT_PT100, TT_INTERCOM. See list in temp.c. * 00252 * * 00253 \***************************************************************************/ 00254 00255 #ifndef DEFINE_TEMP_SENSOR 00256 #define DEFINE_TEMP_SENSOR(...) 00257 #endif 00258 00259 // name type pin 00260 DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO2_PIN) 00261 DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO1_PIN) 00262 00263 00264 00265 /***************************************************************************\ 00266 * * 00267 * 5. HEATERS * 00268 * * 00269 \***************************************************************************/ 00270 00275 // #define HEATER_SANITY_CHECK 00276 00277 /***************************************************************************\ 00278 * * 00279 * Define your heaters here * 00280 * * 00281 * If your heater isn't on a PWM-able pin, set heater_pwm to zero and we'll * 00282 * use bang-bang output. Note that PID will still be used * 00283 * * 00284 * See Appendix 8 at the end of this file for PWMable pin mappings * 00285 * * 00286 * If a heater isn't attached to a temperature sensor above, it can still be * 00287 * controlled by host but otherwise is ignored by firmware * 00288 * * 00289 * To attach a heater to a temp sensor above, simply use exactly the same * 00290 * name - copy+paste is your friend * 00291 * * 00292 * Some common names are 'extruder', 'bed', 'fan', 'motor' * 00293 * * 00294 \***************************************************************************/ 00295 00296 #ifndef DEFINE_HEATER 00297 #define DEFINE_HEATER(...) 00298 #endif 00299 00300 // NOTE: these pins are for RAMPS V1.1 and newer. V1.0 is different 00301 // name port pin pwm 00302 DEFINE_HEATER(extruder, PORTB, PINB4, OCR2A) 00303 DEFINE_HEATER(bed, PORTH, PINH5, OCR4CL) 00304 DEFINE_HEATER(fan, PORTH, PINH6, OCR2B) 00305 // DEFINE_HEATER(chamber, PORTD, PIND7, OCR2A) 00306 // DEFINE_HEATER(motor, PORTD, PIND6, OCR2B) 00307 00313 00314 #define HEATER_EXTRUDER HEATER_extruder 00315 #define HEATER_BED HEATER_bed 00316 // #define HEATER_FAN HEATER_fan 00317 00318 00319 00320 /***************************************************************************\ 00321 * * 00322 * 6. COMMUNICATION OPTIONS * 00323 * * 00324 \***************************************************************************/ 00325 00332 // #define REPRAP_HOST_COMPATIBILITY 19750101 00333 #define REPRAP_HOST_COMPATIBILITY 20100806 00334 // #define REPRAP_HOST_COMPATIBILITY <date of next RepRap Host compatibility break> 00335 00339 #define BAUD 115200 00340 00346 // #define XONXOFF 00347 00348 00349 00350 /***************************************************************************\ 00351 * * 00352 * 7. MISCELLANEOUS OPTIONS * 00353 * * 00354 \***************************************************************************/ 00355 00362 // #define DEBUG 00363 00369 // #define BANG_BANG 00374 // #define BANG_BANG_ON 200 00379 // #define BANG_BANG_OFF 45 00380 00386 #define MOVEBUFFER_SIZE 8 00387 00392 // #define DC_EXTRUDER HEATER_motor 00393 // #define DC_EXTRUDER_PWM 180 00394 00398 // #define USE_WATCHDOG 00399 00404 #define REFERENCE REFERENCE_AVCC 00405 00410 #define STEP_INTERRUPT_INTERRUPTIBLE 1 00411 00416 #define TH_COUNT 8 00417 00419 #define PID_SCALE 1024L 00420 00421 00422 00423 /***************************************************************************\ 00424 * * 00425 * 8. APPENDIX A - PWMABLE PINS AND MAPPINGS * 00426 * * 00427 * * 00428 * list of PWM-able pins and corresponding timers * 00429 * timer1 is used for step timing so don't use OC1A/OC1B * 00430 * they are omitted from this listing for that reason * 00431 * * 00432 * For the atmega168/328, timer/pin mappings are as follows * 00433 * * 00434 * OCR0A - PD6 - DIO6 * 00435 * OCR0B - PD5 - DIO5 * 00436 * OCR2A - PB3 - DIO11 * 00437 * OCR2B - PD3 - DIO3 * 00438 * * 00439 * For the atmega644, timer/pin mappings are as follows * 00440 * * 00441 * OCR0A - PB3 - DIO3 * 00442 * OCR0B - PB4 - DIO4 * 00443 * OCR2A - PD7 - DIO15 * 00444 * OCR2B - PD6 - DIO14 * 00445 * * 00446 * For the atmega1280, timer/pin mappings are as follows * 00447 * * 00448 * OCR0A - PB7 - DIO13 * 00449 * OCR0B - PG5 - DIO4 * 00450 * OCR2A - PB4 - DIO10 * 00451 * OCR2B - PH6 - DIO9 * 00452 * OCR3AL - PE3 - DIO5 * 00453 * OCR3BL - PE4 - DIO2 * 00454 * OCR3CL - PE5 - DIO3 * 00455 * OCR4AL - PH3 - DIO6 * 00456 * OCR4BL - PH4 - DIO7 * 00457 * OCR4CL - PH5 - DIO8 * 00458 * OCR5AL - PL3 - DIO46 * 00459 * OCR5BL - PL4 - DIO45 * 00460 * OCR5CL - PL5 - DIO44 * 00461 * * 00462 \***************************************************************************/