Hi,
what is the actual Pinout for the mega?
I found a Pinout in this threat https://github.com/grbl/grbl/issues/390#issuecomment-140977241
Is this the right one?
Will the pinout change in the near future?
Greetings theblackraven
评论 (4)
#2 – theblackraven 于 2017-02-26
thanks,
as far i can see, the Pinout of this post https://github.com/grbl/grbl/issues/390#issuecomment-140977241
is corresponding to the Pinout of the current config.h.
#3 – oMtQB4 于 2017-06-06
Hi,
currently, I’m building a shield for the Arduino Mega 2560 and I’m close to finish. But I have one question: What is the correct pin for the PWM signal? SPINDLEPWMBIT (Digital Pin 7) or SPINDLEENABLEBIT (Digital Pin 6)?
What is the other pin for?
Thanks
#4 – chamnit 于 2017-06-06
@oMtQB4 : Enable/disable. As it states. The PWM pin is separate output that indicates speed and can be used as an on/off too. The other pin is another way for spindle controllers to know what Grbl is commanding.
#1 – TGit-Tech 于 2017-02-24
I believe the pin-out is defined by the following
In file: ‘config.h’ #define CPUMAP2560_INITIAL // This assigns the map to use
Then the actual pin-map for this definition is in file: ‘cpu_map.h’
As below this was pulled from grbl-Mega-1.0d.20160831 release
#ifdef CPUMAP2560_INITIAL // (Arduino Mega 2560) Working @EliteEng
// Serial port interrupt vectors
#define SERIALRX USART0RX_vect
#define SERIALUDRE USART0UDRE_vect
// Define step pulse output pins. NOTE: All step bit pins must be on the same port.STEPBIT)|(1<STEPBIT)|(1<STEP_BIT)) // All step bits
#define STEP_DDR DDRA
#define STEP_PORT PORTA
#define STEP_PIN PINA
#define XSTEPBIT 2 // MEGA2560 Digital Pin 24
#define YSTEPBIT 3 // MEGA2560 Digital Pin 25
#define ZSTEPBIT 4 // MEGA2560 Digital Pin 26
#define STEPMASK ((1<
// Define step direction output pins. NOTE: All direction pins must be on the same port.DIRECTIONBIT)|(1<DIRECTIONBIT)|(1<DIRECTION_BIT)) // All direction bits
#define DIRECTION_DDR DDRC
#define DIRECTION_PORT PORTC
#define DIRECTION_PIN PINC
#define XDIRECTIONBIT 7 // MEGA2560 Digital Pin 30
#define YDIRECTIONBIT 6 // MEGA2560 Digital Pin 31
#define ZDIRECTIONBIT 5 // MEGA2560 Digital Pin 32
#define DIRECTIONMASK ((1<
// Define stepper driver enable/disable output pin.DISABLEBIT)
#define STEPPERSDISABLEDDR DDRB
#define STEPPERSDISABLEPORT PORTB
#define STEPPERSDISABLEBIT 7 // MEGA2560 Digital Pin 13
#define STEPPERSDISABLEMASK (1<
// Define homing/hard limit switch input pins and limit interrupt vectors.LIMITBIT)|(1<LIMITBIT)|(1<LIMIT_BIT)) // All limit bits
// NOTE: All limit bit pins must be on the same port
#define LIMIT_DDR DDRB
#define LIMIT_PORT PORTB
#define LIMIT_PIN PINB
#define XLIMITBIT 4 // MEGA2560 Digital Pin 10
#define YLIMITBIT 5 // MEGA2560 Digital Pin 11
#define ZLIMITBIT 6 // MEGA2560 Digital Pin 12
#define LIMIT_INT PCIE0 // Pin change interrupt enable pin
#define LIMITINTvect PCINT0_vect
#define LIMIT_PCMSK PCMSK0 // Pin change interrupt register
#define LIMITMASK ((1<
// Define spindle enable and spindle direction output pins.
#define SPINDLEENABLEDDR DDRH
#define SPINDLEENABLEPORT PORTH
#define SPINDLEENABLEBIT 3 // MEGA2560 Digital Pin 6
#define SPINDLEDIRECTIONDDR DDRE
#define SPINDLEDIRECTIONPORT PORTE
#define SPINDLEDIRECTIONBIT 3 // MEGA2560 Digital Pin 5
// Define flood and mist coolant enable output pins.
#define COOLANTFLOODDDR DDRH
#define COOLANTFLOODPORT PORTH
#define COOLANTFLOODBIT 5 // MEGA2560 Digital Pin 8
#define COOLANTMISTDDR DDRH
#define COOLANTMISTPORT PORTH
#define COOLANTMISTBIT 6 // MEGA2560 Digital Pin 9
// Define user-control CONTROLs (cycle start, reset, feed hold) input pins.RESETBIT)|(1<FEEDHOLDBIT)|(1<CYCLE STARTBIT)|(1<SAFETYDOORBIT))
// NOTE: All CONTROLs pins must be on the same port and not on a port with other input pins (limits).
#define CONTROL_DDR DDRK
#define CONTROL_PIN PINK
#define CONTROL_PORT PORTK
#define CONTROLRESETBIT 0 // MEGA2560 Analog Pin 8
#define CONTROLFEEDHOLD_BIT 1 // MEGA2560 Analog Pin 9
#define CONTROLCYCLESTART_BIT 2 // MEGA2560 Analog Pin 10
#define CONTROLSAFETYDOOR_BIT 3 // MEGA2560 Analog Pin 11
#define CONTROL_INT PCIE2 // Pin change interrupt enable pin
#define CONTROLINTvect PCINT2_vect
#define CONTROL_PCMSK PCMSK2 // Pin change interrupt register
#define CONTROLMASK ((1<
// Define probe switch input pin.BIT)
#define PROBE_DDR DDRK
#define PROBE_PIN PINK
#define PROBE_PORT PORTK
#define PROBE_BIT 7 // MEGA2560 Analog Pin 15
#define PROBEMASK (1<
// Advanced Configuration Below You should not need to touch these variablesTCCRBINIT_MASK ((1<OCRAREGISTER OCR4A // 16-bit Fast PWM mode requires top reset value stored here.
// Set Timer up to use TIMER4B which is attached to Digital Pin 7
#define SPINDLEPWMMAX_VALUE 1024.0 // Translates to about 1.9 kHz PWM frequency at 1/8 prescaler
#define SPINDLETCCRAREGISTER TCCR4A
#define SPINDLETCCRBREGISTER TCCR4B
#define SPINDLEOCRREGISTER OCR4B
#define SPINDLECOMBBIT COM4B1
// 1/8 Prescaler, 16-bit Fast PWM mode
#define SPINDLETCCRAINIT_MASK ((1<
#define SPINDLEOCRATOPVALUE 0x0400 // PWM counter reset value. Should be the same as PWMMAX_VALUE in hex.
// Define spindle output pins.
#define SPINDLEPWMDDR DDRH
#define SPINDLEPWMPORT PORTH
#define SPINDLEPWMBIT 4 // MEGA2560 Digital Pin 7
#endif