Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.94 KB | None | 0 0
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22.  
  23. /**
  24. * Arduino Mega with RAMPS v1.4 (or v1.3) pin assignments
  25. *
  26. * Applies to the following boards:
  27. *
  28. * RAMPS_14_EFB (Hotend, Fan, Bed)
  29. * RAMPS_14_EEB (Hotend0, Hotend1, Bed)
  30. * RAMPS_14_EFF (Hotend, Fan0, Fan1)
  31. * RAMPS_14_EEF (Hotend0, Hotend1, Fan)
  32. * RAMPS_14_SF (Spindle, Controller Fan)
  33. *
  34. * RAMPS_13_EFB (Hotend, Fan, Bed)
  35. * RAMPS_13_EEB (Hotend0, Hotend1, Bed)
  36. * RAMPS_13_EFF (Hotend, Fan0, Fan1)
  37. * RAMPS_13_EEF (Hotend0, Hotend1, Fan)
  38. * RAMPS_13_SF (Spindle, Controller Fan)
  39. *
  40. * Other pins_MYBOARD.h files may override these defaults
  41. *
  42. * Differences between
  43. * RAMPS_13 | RAMPS_14
  44. * 7 | 11
  45. */
  46.  
  47. #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__)
  48. #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu."
  49. #endif
  50.  
  51. #ifndef BOARD_NAME
  52. #define BOARD_NAME "RAMPS 1.4"
  53. #endif
  54.  
  55. //
  56. // Servos
  57. //
  58. #ifdef IS_RAMPS_13
  59. #define SERVO0_PIN 7 // RAMPS_13 // Will conflict with BTN_EN2 on LCD_I2C_VIKI
  60. #else
  61. #define SERVO0_PIN 11
  62. #endif
  63. #define SERVO1_PIN 6
  64. #define SERVO2_PIN 5
  65. #ifndef SERVO3_PIN
  66. #define SERVO3_PIN 4
  67. #endif
  68.  
  69. //
  70. // Limit Switches
  71. //
  72. #define X_MIN_PIN 3
  73. #ifndef X_MAX_PIN
  74. #define X_MAX_PIN 2
  75. #endif
  76. #define Y_MIN_PIN 14
  77. #define Y_MAX_PIN 15
  78. #define Z_MIN_PIN 18
  79. #define Z_MAX_PIN 19
  80.  
  81. //
  82. // Z Probe (when not Z_MIN_PIN)
  83. //
  84. #ifndef Z_MIN_PROBE_PIN
  85. #define Z_MIN_PROBE_PIN 32
  86. #endif
  87.  
  88. //
  89. // Steppers
  90. //
  91. #define X_STEP_PIN 54
  92. #define X_DIR_PIN 55
  93. #define X_ENABLE_PIN 38
  94. #ifndef X_CS_PIN
  95. #define X_CS_PIN 59
  96. #endif
  97.  
  98. #define Y_STEP_PIN 60
  99. #define Y_DIR_PIN 61
  100. #define Y_ENABLE_PIN 56
  101. #ifndef Y_CS_PIN
  102. #define Y_CS_PIN 63
  103. #endif
  104.  
  105. #define Z_STEP_PIN 46
  106. #define Z_DIR_PIN 48
  107. #define Z_ENABLE_PIN 62
  108. #ifndef Z_CS_PIN
  109. #define Z_CS_PIN 40 // 64
  110. #endif
  111.  
  112. #define E0_STEP_PIN 26
  113. #define E0_DIR_PIN 28
  114. #define E0_ENABLE_PIN 24
  115. #ifndef E0_CS_PIN
  116. #define E0_CS_PIN 64 // 44
  117. #endif
  118.  
  119. #define E1_STEP_PIN 36
  120. #define E1_DIR_PIN 34
  121. #define E1_ENABLE_PIN 30
  122. #ifndef E1_CS_PIN
  123. #define E1_CS_PIN 44 //40
  124. #endif
  125. #ifndef Z1_CS_PIN
  126. #define Z1_CS_PIN 44 //40
  127. #endif
  128.  
  129.  
  130.  
  131. /**
  132. * Default pins for TMC software SPI
  133. */
  134. #if ENABLED(TMC_USE_SW_SPI)
  135. #ifndef TMC_SW_MOSI
  136. #define TMC_SW_MOSI 51
  137. #endif
  138. #ifndef TMC_SW_MISO
  139. #define TMC_SW_MISO 50
  140. #endif
  141. #ifndef TMC_SW_SCK
  142. #define TMC_SW_SCK 52
  143. #endif
  144. #endif
  145.  
  146. #if HAS_DRIVER(TMC2208)
  147. /**
  148. * TMC2208 stepper drivers
  149. *
  150. * Hardware serial communication ports.
  151. * If undefined software serial is used according to the pins below
  152. */
  153. //#define X_HARDWARE_SERIAL Serial1
  154. //#define X2_HARDWARE_SERIAL Serial1
  155. //#define Y_HARDWARE_SERIAL Serial1
  156. //#define Y2_HARDWARE_SERIAL Serial1
  157. //#define Z_HARDWARE_SERIAL Serial1
  158. //#define Z2_HARDWARE_SERIAL Serial1
  159. //#define E0_HARDWARE_SERIAL Serial1
  160. //#define E1_HARDWARE_SERIAL Serial1
  161. //#define E2_HARDWARE_SERIAL Serial1
  162. //#define E3_HARDWARE_SERIAL Serial1
  163. //#define E4_HARDWARE_SERIAL Serial1
  164.  
  165. /**
  166. * Software serial
  167. */
  168.  
  169. #define X_SERIAL_TX_PIN 40
  170. #define X_SERIAL_RX_PIN 63
  171. #define X2_SERIAL_TX_PIN -1
  172. #define X2_SERIAL_RX_PIN -1
  173.  
  174. #define Y_SERIAL_TX_PIN 59
  175. #define Y_SERIAL_RX_PIN 64
  176. #define Y2_SERIAL_TX_PIN -1
  177. #define Y2_SERIAL_RX_PIN -1
  178.  
  179. #define Z_SERIAL_TX_PIN 42
  180. #define Z_SERIAL_RX_PIN 65
  181. #define Z2_SERIAL_TX_PIN -1
  182. #define Z2_SERIAL_RX_PIN -1
  183.  
  184. #define E0_SERIAL_TX_PIN 44
  185. #define E0_SERIAL_RX_PIN 66
  186. #define E1_SERIAL_TX_PIN -1
  187. #define E1_SERIAL_RX_PIN -1
  188. #define E2_SERIAL_TX_PIN -1
  189. #define E2_SERIAL_RX_PIN -1
  190. #define E3_SERIAL_TX_PIN -1
  191. #define E3_SERIAL_RX_PIN -1
  192. #define E4_SERIAL_TX_PIN -1
  193. #define E4_SERIAL_RX_PIN -1
  194. #endif
  195.  
  196. //
  197. // Temperature Sensors
  198. //
  199. #define TEMP_0_PIN 13 // Analog Input
  200. #define TEMP_1_PIN 15 // Analog Input
  201. #define TEMP_BED_PIN 14 // Analog Input
  202.  
  203. // SPI for Max6675 or Max31855 Thermocouple
  204. #if DISABLED(SDSUPPORT)
  205. #define MAX6675_SS 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card
  206. #else
  207. #define MAX6675_SS 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
  208. #endif
  209.  
  210. //
  211. // Augmentation for auto-assigning RAMPS plugs
  212. //
  213. #if DISABLED(IS_RAMPS_EEB) && DISABLED(IS_RAMPS_EEF) && DISABLED(IS_RAMPS_EFB) && DISABLED(IS_RAMPS_EFF) && DISABLED(IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D)
  214. #if HOTENDS > 1
  215. #if TEMP_SENSOR_BED
  216. #define IS_RAMPS_EEB
  217. #else
  218. #define IS_RAMPS_EEF
  219. #endif
  220. #elif TEMP_SENSOR_BED
  221. #define IS_RAMPS_EFB
  222. #else
  223. #define IS_RAMPS_EFF
  224. #endif
  225. #endif
  226.  
  227. //
  228. // Heaters / Fans
  229. //
  230. #ifndef MOSFET_D_PIN
  231. #define MOSFET_D_PIN -1
  232. #endif
  233. #ifndef RAMPS_D8_PIN
  234. #define RAMPS_D8_PIN 8
  235. #endif
  236. #ifndef RAMPS_D9_PIN
  237. #define RAMPS_D9_PIN 9
  238. #endif
  239. #ifndef RAMPS_D10_PIN
  240. #define RAMPS_D10_PIN 10
  241. #endif
  242.  
  243. #define HEATER_0_PIN RAMPS_D10_PIN
  244.  
  245. #if ENABLED(IS_RAMPS_EFB) // Hotend, Fan, Bed
  246. #define HEATER_BED_PIN RAMPS_D8_PIN
  247. #elif ENABLED(IS_RAMPS_EEF) // Hotend, Hotend, Fan
  248. #define HEATER_1_PIN RAMPS_D9_PIN
  249. #elif ENABLED(IS_RAMPS_EEB) // Hotend, Hotend, Bed
  250. #define HEATER_1_PIN RAMPS_D9_PIN
  251. #define HEATER_BED_PIN RAMPS_D8_PIN
  252. #elif ENABLED(IS_RAMPS_EFF) // Hotend, Fan, Fan
  253. #define FAN1_PIN RAMPS_D8_PIN
  254. #elif DISABLED(IS_RAMPS_SF) // Not Spindle, Fan (i.e., "EFBF" or "EFBE")
  255. #define HEATER_BED_PIN RAMPS_D8_PIN
  256. #if HOTENDS == 1
  257. #define FAN1_PIN MOSFET_D_PIN
  258. #else
  259. #define HEATER_1_PIN MOSFET_D_PIN
  260. #endif
  261. #endif
  262.  
  263. #ifndef FAN_PIN
  264. #if ENABLED(IS_RAMPS_EFB) || ENABLED(IS_RAMPS_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan
  265. #define FAN_PIN RAMPS_D9_PIN
  266. #elif ENABLED(IS_RAMPS_EEF) || ENABLED(IS_RAMPS_SF) // Hotend, Hotend, Fan or Spindle, Fan
  267. #define FAN_PIN RAMPS_D8_PIN
  268. #elif ENABLED(IS_RAMPS_EEB) // Hotend, Hotend, Bed
  269. #define FAN_PIN 4 // IO pin. Buffer needed
  270. #else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE")
  271. #define FAN_PIN RAMPS_D9_PIN
  272. #endif
  273. #endif
  274.  
  275. //
  276. // Misc. Functions
  277. //
  278. #define SDSS 53
  279. #define LED_PIN 13
  280.  
  281. #ifndef FILWIDTH_PIN
  282. #define FILWIDTH_PIN 5 // Analog Input on AUX2
  283. #endif
  284.  
  285. // define digital pin 4 for the filament runout sensor. Use the RAMPS 1.4 digital input 4 on the servos connector
  286. #ifndef FIL_RUNOUT_PIN
  287. #define FIL_RUNOUT_PIN 4
  288. #endif
  289.  
  290. #ifndef PS_ON_PIN
  291. #define PS_ON_PIN 12
  292. #endif
  293.  
  294. #if ENABLED(CASE_LIGHT_ENABLE) && !defined(CASE_LIGHT_PIN) && !defined(SPINDLE_LASER_ENABLE_PIN)
  295. #if NUM_SERVOS <= 1 // try to use servo connector first
  296. #define CASE_LIGHT_PIN 6 // MUST BE HARDWARE PWM
  297. #elif !(ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) \
  298. && (ENABLED(PANEL_ONE) || ENABLED(VIKI2) || ENABLED(miniVIKI) || ENABLED(MINIPANEL) || ENABLED(REPRAPWORLD_KEYPAD))) // try to use AUX 2
  299. #define CASE_LIGHT_PIN 44 // MUST BE HARDWARE PWM
  300. #endif
  301. #endif
  302.  
  303. //
  304. // M3/M4/M5 - Spindle/Laser Control
  305. //
  306. #if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENABLE)
  307. #if !defined(NUM_SERVOS) || NUM_SERVOS == 0 // try to use servo connector first
  308. #define SPINDLE_LASER_ENABLE_PIN 4 // Pin should have a pullup/pulldown!
  309. #define SPINDLE_LASER_PWM_PIN 6 // MUST BE HARDWARE PWM
  310. #define SPINDLE_DIR_PIN 5
  311. #elif !(ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) \
  312. && (ENABLED(PANEL_ONE) || ENABLED(VIKI2) || ENABLED(miniVIKI) || ENABLED(MINIPANEL) || ENABLED(REPRAPWORLD_KEYPAD))) // try to use AUX 2
  313. #define SPINDLE_LASER_ENABLE_PIN 40 // Pin should have a pullup/pulldown!
  314. #define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM
  315. #define SPINDLE_DIR_PIN 65
  316. #endif
  317. #endif
  318.  
  319. //
  320. // Průša i3 MK2 Multiplexer Support
  321. //
  322. #ifndef E_MUX0_PIN
  323. #define E_MUX0_PIN 40 // Z_CS_PIN
  324. #endif
  325. #ifndef E_MUX1_PIN
  326. #define E_MUX1_PIN 42 // E0_CS_PIN
  327. #endif
  328. #ifndef E_MUX2_PIN
  329. #define E_MUX2_PIN 44 // E1_CS_PIN
  330. #endif
  331.  
  332. //////////////////////////
  333. // LCDs and Controllers //
  334. //////////////////////////
  335.  
  336. #if ENABLED(ULTRA_LCD)
  337.  
  338. //
  339. // LCD Display output pins
  340. //
  341. #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
  342.  
  343. #define LCD_PINS_RS 49 // CS chip select /SS chip slave select
  344. #define LCD_PINS_ENABLE 51 // SID (MOSI)
  345. #define LCD_PINS_D4 52 // SCK (CLK) clock
  346.  
  347. #elif ENABLED(NEWPANEL) && ENABLED(PANEL_ONE)
  348.  
  349. #define LCD_PINS_RS 40
  350. #define LCD_PINS_ENABLE 42
  351. #define LCD_PINS_D4 65
  352. #define LCD_PINS_D5 66
  353. #define LCD_PINS_D6 44
  354. #define LCD_PINS_D7 64
  355.  
  356. #else
  357.  
  358. #if ENABLED(CR10_STOCKDISPLAY)
  359.  
  360. #define LCD_PINS_RS 27
  361. #define LCD_PINS_ENABLE 29
  362. #define LCD_PINS_D4 25
  363.  
  364. #if DISABLED(NEWPANEL)
  365. #define BEEPER_PIN 37
  366. #endif
  367.  
  368. #elif ENABLED(ZONESTAR_LCD)
  369.  
  370. #define LCD_PINS_RS 64
  371. #define LCD_PINS_ENABLE 44
  372. #define LCD_PINS_D4 63
  373. #define LCD_PINS_D5 40
  374. #define LCD_PINS_D6 42
  375. #define LCD_PINS_D7 65
  376.  
  377. #else
  378.  
  379. #if ENABLED(MKS_12864OLED) || ENABLED(MKS_12864OLED_SSD1306)
  380. #define LCD_PINS_DC 25 // Set as output on init
  381. #define LCD_PINS_RS 27 // Pull low for 1s to init
  382. // DOGM SPI LCD Support
  383. #define DOGLCD_CS 16
  384. #define DOGLCD_MOSI 17
  385. #define DOGLCD_SCK 23
  386. #define DOGLCD_A0 LCD_PINS_DC
  387. #else
  388. #define LCD_PINS_RS 16
  389. #define LCD_PINS_ENABLE 17
  390. #define LCD_PINS_D4 23
  391. #define LCD_PINS_D5 25
  392. #define LCD_PINS_D6 27
  393. #endif
  394.  
  395. #define LCD_PINS_D7 29
  396.  
  397. #if DISABLED(NEWPANEL)
  398. #define BEEPER_PIN 33
  399. #endif
  400.  
  401. #endif
  402.  
  403. #if DISABLED(NEWPANEL)
  404. // Buttons are attached to a shift register
  405. // Not wired yet
  406. //#define SHIFT_CLK 38
  407. //#define SHIFT_LD 42
  408. //#define SHIFT_OUT 40
  409. //#define SHIFT_EN 17
  410. #endif
  411.  
  412. #endif
  413.  
  414. //
  415. // LCD Display input pins
  416. //
  417. #if ENABLED(NEWPANEL)
  418.  
  419. #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
  420.  
  421. #define BEEPER_PIN 37
  422.  
  423. #if ENABLED(CR10_STOCKDISPLAY)
  424. #define BTN_EN1 17
  425. #define BTN_EN2 23
  426. #else
  427. #define BTN_EN1 31
  428. #define BTN_EN2 33
  429. #endif
  430.  
  431. #define BTN_ENC 35
  432. #define SD_DETECT_PIN 49
  433. #define KILL_PIN 41
  434.  
  435. #if ENABLED(BQ_LCD_SMART_CONTROLLER)
  436. #define LCD_BACKLIGHT_PIN 39
  437. #endif
  438.  
  439. #elif ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
  440.  
  441. #define BTN_EN1 64
  442. #define BTN_EN2 59
  443. #define BTN_ENC 63
  444. #define SD_DETECT_PIN 42
  445.  
  446. #elif ENABLED(LCD_I2C_PANELOLU2)
  447.  
  448. #define BTN_EN1 47
  449. #define BTN_EN2 43
  450. #define BTN_ENC 32
  451. #define LCD_SDSS SDSS
  452. #define KILL_PIN 41
  453.  
  454. #elif ENABLED(LCD_I2C_VIKI)
  455.  
  456. #define BTN_EN1 22 // http://files.panucatt.com/datasheets/viki_wiring_diagram.pdf explains 40/42.
  457. #define BTN_EN2 7 // 22/7 are unused on RAMPS_14. 22 is unused and 7 the SERVO0_PIN on RAMPS_13.
  458. #define BTN_ENC -1
  459.  
  460. #define LCD_SDSS SDSS
  461. #define SD_DETECT_PIN 49
  462.  
  463. #elif ENABLED(VIKI2) || ENABLED(miniVIKI)
  464.  
  465. #define DOGLCD_CS 45
  466. #define DOGLCD_A0 44
  467. #define LCD_SCREEN_ROT_180
  468.  
  469. #define BEEPER_PIN 33
  470. #define STAT_LED_RED_PIN 32
  471. #define STAT_LED_BLUE_PIN 35
  472.  
  473. #define BTN_EN1 22
  474. #define BTN_EN2 7
  475. #define BTN_ENC 39
  476.  
  477. #define SD_DETECT_PIN -1 // Pin 49 for display sd interface, 72 for easy adapter board
  478. #define KILL_PIN 31
  479.  
  480. #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
  481.  
  482. #define DOGLCD_CS 29
  483. #define DOGLCD_A0 27
  484.  
  485. #define BEEPER_PIN 23
  486. #define LCD_BACKLIGHT_PIN 33
  487.  
  488. #define BTN_EN1 35
  489. #define BTN_EN2 37
  490. #define BTN_ENC 31
  491.  
  492. #define LCD_SDSS SDSS
  493. #define SD_DETECT_PIN 49
  494. #define KILL_PIN 41
  495.  
  496. #elif ENABLED(MKS_MINI_12864) // Added in Marlin 1.1.6
  497.  
  498. #define DOGLCD_A0 27
  499. #define DOGLCD_CS 25
  500.  
  501. // GLCD features
  502. //#define LCD_CONTRAST 190
  503. // Uncomment screen orientation
  504. //#define LCD_SCREEN_ROT_90
  505. //#define LCD_SCREEN_ROT_180
  506. //#define LCD_SCREEN_ROT_270
  507.  
  508. #define BEEPER_PIN 37
  509. // not connected to a pin
  510. #define LCD_BACKLIGHT_PIN 65 // backlight LED on A11/D65
  511.  
  512. #define BTN_EN1 31
  513. #define BTN_EN2 33
  514. #define BTN_ENC 35
  515.  
  516. #define SD_DETECT_PIN 49
  517. #define KILL_PIN 64
  518.  
  519. #elif ENABLED(MINIPANEL)
  520.  
  521. #define BEEPER_PIN 42
  522. // not connected to a pin
  523. #define LCD_BACKLIGHT_PIN 65 // backlight LED on A11/D65
  524.  
  525. #define DOGLCD_A0 44
  526. #define DOGLCD_CS 66
  527.  
  528. // GLCD features
  529. //#define LCD_CONTRAST 190
  530. // Uncomment screen orientation
  531. //#define LCD_SCREEN_ROT_90
  532. //#define LCD_SCREEN_ROT_180
  533. //#define LCD_SCREEN_ROT_270
  534.  
  535. #define BTN_EN1 40
  536. #define BTN_EN2 63
  537. #define BTN_ENC 59
  538.  
  539. #define SD_DETECT_PIN 49
  540. #define KILL_PIN 64
  541.  
  542. #elif ENABLED(ZONESTAR_LCD)
  543.  
  544. #define ADC_KEYPAD_PIN 12
  545.  
  546. #else
  547.  
  548. // Beeper on AUX-4
  549. #define BEEPER_PIN 33
  550.  
  551. // Buttons are directly attached using AUX-2
  552. #if ENABLED(REPRAPWORLD_KEYPAD)
  553. #define SHIFT_OUT 40
  554. #define SHIFT_CLK 44
  555. #define SHIFT_LD 42
  556. #define BTN_EN1 64
  557. #define BTN_EN2 59
  558. #define BTN_ENC 63
  559. #elif ENABLED(PANEL_ONE)
  560. #define BTN_EN1 59 // AUX2 PIN 3
  561. #define BTN_EN2 63 // AUX2 PIN 4
  562. #define BTN_ENC 49 // AUX3 PIN 7
  563. #else
  564. #define BTN_EN1 37
  565. #define BTN_EN2 35
  566. #define BTN_ENC 31
  567. #endif
  568.  
  569. #if ENABLED(G3D_PANEL)
  570. #define SD_DETECT_PIN 49
  571. #define KILL_PIN 41
  572. #endif
  573.  
  574. #endif
  575. #endif // NEWPANEL
  576.  
  577. #endif // ULTRA_LCD
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement