00001 //TODO: fix this blasphemy! 00002 /* Notice to developers: this file is intentionally included twice. */ 00003 00010 /* 00011 CONTENTS 00012 00013 1. Mechanical/Hardware 00014 2. Acceleration settings 00015 3. Pinouts 00016 4. Communication options 00017 5. Miscellaneous 00018 6. Appendix A - PWMable pins and mappings 00019 */ 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 //TODO: make this more crystal clear when splitting the code into panel and physics 00038 #define HOST 00039 00040 /* 00041 Values reflecting the gearing of your machine. 00042 */ 00060 // The S-720 has 6mm pitch lead screws, 1.8deg steppers and the Zero3 is a 1:10 00061 // microstepping driver, thus giving 333333.(3) steps per meter. 00062 // YES, coming up with a fractional numer of steps per whole length unit is 00063 // stupid, but that's what you get when you don't design and build your own. 00064 #define STEPS_PER_M_X 333333 00065 #define STEPS_PER_M_Y 333333 00066 #define STEPS_PER_M_Z 333333 00067 00068 /* 00069 Values depending on the capabilities of your stepper motors and other mechanics. 00070 All numbers are integers, no decimals allowed. 00071 00072 Units are mm/min 00073 */ 00075 //TODO: sort out why we can't seem to go over 2000mm/min when we should be able to do 2500mm/min according to the specs 00076 #define MAXIMUM_FEEDRATE_X 2000 00077 #define MAXIMUM_FEEDRATE_Y 2000 00078 #define MAXIMUM_FEEDRATE_Z 2000 00079 00081 #define SEARCH_FEEDRATE_X 60 00082 #define SEARCH_FEEDRATE_Y 60 00083 #define SEARCH_FEEDRATE_Z 60 00084 00089 // The S-720 is well enough engineered that (for X) there are 720mm of travel 00090 // between the home switch and the hard limit with about 5mm to spare at both 00091 // ends. Thus, no cropping needed. 00092 #define X_MIN 0.0 00093 #define X_MAX 720.0 00094 #define Y_MIN 0.0 00095 #define Y_MAX 420.0 00096 #define Z_MIN 0.0 00097 #define Z_MAX 110.0 00098 00099 00100 /***************************************************************************\ 00101 * * 00102 * 2. ACCELERATION * 00103 * * 00104 * IMPORTANT: choose only one! These algorithms choose when to step, trying * 00105 * to use more than one will have undefined and probably * 00106 * disastrous results! * 00107 * * 00108 \***************************************************************************/ 00109 00114 // #define ACCELERATION_REPRAP 00115 00120 #define ACCELERATION_RAMPING 00121 00126 #define ACCELERATION 50. 00127 00140 // #define ACCELERATION_TEMPORAL 00141 00142 00143 /***************************************************************************\ 00144 * * 00145 * 3. PINOUTS * 00146 * * 00147 \***************************************************************************/ 00148 00149 /* 00150 Machine Pin Definitions 00151 - make sure to avoid duplicate usage of a pin 00152 - comment out pins not in use, as this drops the corresponding code and makes operations faster 00153 */ 00154 #include "arduino.h" 00155 00156 /* 00157 user defined pins 00158 adjust to suit your electronics, or adjust your electronics to suit this 00159 00160 Please note that Spindle/Coolant ON/OFF and Spindle PWM are missing 00161 because they're generated by the Panel MCU. 00162 E-Stop and Charge Pump are here because we need to stop ASAP if the button 00163 is hit and we can't risk leaving that to the Panel MCU. 00164 Please note that this refers to the E-Stop button on our front panel -- the 00165 Zero3 already takes action by itself for the one on the machine and the one on 00166 its own panel. 00167 */ 00168 00169 // This pin mapping puts Charge Pump on a PWM-able pin, just in case we decide 00170 // to generate it in hardware in the future. It also leaves out the other two 00171 // PWM pins, just in case we need them later on. 00172 // This also does not use the SPI pins such that INTERCOM can run over those. 00173 // In the production assembly (which uses the Pro Mini instead of the Uno), the 00174 // I2C pins are also free. 00175 // X-axis controls 00176 #define X_STEP_PIN AIO0 00177 #define X_DIR_PIN AIO1 00178 #define X_MIN_PIN AIO2 00179 // The S-720 has the X-axis backwards 00180 #define X_INVERT_DIR 1 00181 // ... and all limit switches active-low 00182 #define X_INVERT_MIN 1 00183 00184 // Y-axis controls 00185 #define Y_STEP_PIN AIO3 00186 // AIO6 in production (Pro Mini) 00187 #define Y_DIR_PIN AIO4 00188 // AIO7 in production (Pro Mini) 00189 #define Y_MIN_PIN AIO5 00190 //#define Y_INVERT_DIR 00191 #define Y_INVERT_MIN 1 00192 00193 // Z-axis controls 00194 #define Z_STEP_PIN DIO2 00195 #define Z_DIR_PIN DIO4 00196 #define Z_MIN_PIN DIO7 00197 //#define Z_INVERT_DIR 00198 #define Z_INVERT_MIN 1 00199 00200 // 12.5kHz Watchdog signal 00201 #define CHARGEPUMP_PIN DIO3 00202 00203 // Emergency stop signal 00204 #define ESTOP_IN_PIN DIO8 00205 // The Zero3 has an active-low E-Stop Output 00206 #define ESTOP_INVERT_IN 1 00207 00208 00209 /***************************************************************************\ 00210 * * 00211 * 4. COMMUNICATION OPTIONS * 00212 * * 00213 \***************************************************************************/ 00214 00218 #define BAUD 115200 00219 00224 #define XONXOFF 00225 00226 00227 /***************************************************************************\ 00228 * * 00229 * 5. MISCELLANEOUS OPTIONS * 00230 * * 00231 \***************************************************************************/ 00232 00239 // #define DEBUG 00240 00246 #define MOVEBUFFER_SIZE 8 00247 00255 #define USE_WATCHDOG 00256 00262 //#define STEP_INTERRUPT_INTERRUPTIBLE 1 00263 #define STEP_INTERRUPT_INTERRUPTIBLE 0 00264 00273 #define ENDSTOP_STEPS 4 00274 00275 00276 /***************************************************************************\ 00277 * * 00278 * 6. APPENDIX A - PWMABLE PINS AND MAPPINGS * 00279 * * 00280 * * 00281 * list of PWM-able pins and corresponding timers * 00282 * timer1 is used for step timing so don't use OC1A/OC1B * 00283 * they are omitted from this listing for that reason * 00284 * * 00285 * For the atmega168/328, timer/pin mappings are as follows * 00286 * * 00287 * OCR0A - PD6 - DIO6 * 00288 * OCR0B - PD5 - DIO5 * 00289 * OCR2A - PB3 - DIO11 * 00290 * OCR2B - PD3 - DIO3 * 00291 * * 00292 * For the atmega644, timer/pin mappings are as follows * 00293 * * 00294 * OCR0A - PB3 - DIO3 * 00295 * OCR0B - PB4 - DIO4 * 00296 * OCR2A - PD7 - DIO15 * 00297 * OCR2B - PD6 - DIO14 * 00298 * * 00299 * For the atmega1280, timer/pin mappings are as follows * 00300 * * 00301 * OCR0A - PB7 - DIO13 * 00302 * OCR0B - PG5 - DIO4 * 00303 * OCR2A - PB4 - DIO10 * 00304 * OCR2B - PH6 - DIO9 * 00305 * OCR3AL - PE3 - DIO5 * 00306 * OCR3BL - PE4 - DIO2 * 00307 * OCR3CL - PE5 - DIO3 * 00308 * OCR4AL - PH3 - DIO6 * 00309 * OCR4BL - PH4 - DIO7 * 00310 * OCR4CL - PH5 - DIO8 * 00311 * OCR5AL - PL3 - DIO46 * 00312 * OCR5BL - PL4 - DIO45 * 00313 * OCR5CL - PL5 - DIO44 * 00314 * * 00315 \***************************************************************************/