PWM Spindle Control and Invert Spindle & Coolant Pins
PWM Spindle Control and Invert Spindle & Coolant Pins
This commit is contained in:
134
cpu_map.h
134
cpu_map.h
@ -34,6 +34,9 @@
|
||||
#define SERIAL_RX USART_RX_vect
|
||||
#define SERIAL_UDRE USART_UDRE_vect
|
||||
|
||||
// Start of PWM & Stepper Enabled Spindle
|
||||
// #define VARIABLE_SPINDLE // comment this out to disable PWM & Stepper on the spindle
|
||||
|
||||
// NOTE: All step bit and direction pins must be on the same port.
|
||||
#define STEPPING_DDR DDRD
|
||||
#define STEPPING_PORT PORTD
|
||||
@ -54,6 +57,20 @@
|
||||
#define STEPPERS_DISABLE_BIT 0 // Uno Digital Pin 8
|
||||
#define STEPPERS_DISABLE_MASK (1<<STEPPERS_DISABLE_BIT)
|
||||
|
||||
#ifdef VARIABLE_SPINDLE // Z LImit has been disabled to make room for the Spindle PWM
|
||||
// NOTE: All limit bit pins must be on the same port
|
||||
#define LIMIT_DDR DDRB
|
||||
#define LIMIT_PIN PINB
|
||||
#define LIMIT_PORT PORTB
|
||||
#define X_LIMIT_BIT 1 // Uno Digital Pin 9
|
||||
#define Y_LIMIT_BIT 2 // Uno Digital Pin 9
|
||||
#define Z_LIMIT_BIT 2 // Uno Digital Pin 11
|
||||
#define LIMIT_INT PCIE0 // Pin change interrupt enable pin
|
||||
#define LIMIT_INT_vect PCINT0_vect
|
||||
#define LIMIT_PCMSK PCMSK0 // Pin change interrupt register
|
||||
#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)) // All limit bits
|
||||
|
||||
#else
|
||||
// NOTE: All limit bit pins must be on the same port
|
||||
#define LIMIT_DDR DDRB
|
||||
#define LIMIT_PIN PINB
|
||||
@ -65,6 +82,12 @@
|
||||
#define LIMIT_INT_vect PCINT0_vect
|
||||
#define LIMIT_PCMSK PCMSK0 // Pin change interrupt register
|
||||
#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)) // All limit bits
|
||||
#endif
|
||||
|
||||
// WARNING if INVERT_SPINDLE is defined the pin will be LOW(Active) on reset of controller until spindle_init() is called.
|
||||
// this should only be a very short period of time but will energise the spindle.
|
||||
// #define INVERT_SPINDLE // This will INVERT the Spindle LOW=Active
|
||||
// END WARNING
|
||||
|
||||
#define SPINDLE_ENABLE_DDR DDRB
|
||||
#define SPINDLE_ENABLE_PORT PORTB
|
||||
@ -74,6 +97,11 @@
|
||||
#define SPINDLE_DIRECTION_PORT PORTB
|
||||
#define SPINDLE_DIRECTION_BIT 5 // Uno Digital Pin 13 (NOTE: D13 can't be pulled-high input due to LED.)
|
||||
|
||||
// WARNING if INVERT_COOLANT is defined the pin will be LOW(Active) on reset of controller until coolant_init() is called.
|
||||
// this should only be a very short period of time but will energise the coolant pump.
|
||||
// #define INVERT_COOLANT // This will INVERT the Coolant LOW=Active
|
||||
// END WARNING
|
||||
|
||||
#define COOLANT_FLOOD_DDR DDRC
|
||||
#define COOLANT_FLOOD_PORT PORTC
|
||||
#define COOLANT_FLOOD_BIT 3 // Uno Analog Pin 3
|
||||
@ -99,20 +127,46 @@
|
||||
#define PINOUT_PCMSK PCMSK1 // Pin change interrupt register
|
||||
#define PINOUT_MASK ((1<<PIN_RESET)|(1<<PIN_FEED_HOLD)|(1<<PIN_CYCLE_START))
|
||||
|
||||
#endif
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
|
||||
#define SPINDLE_IS_PWM // Uncomment this if your Spindle uses PWM ie. DC Motor
|
||||
|
||||
#ifdef SPINDLE_IS_PWM
|
||||
#define SPINDLE_MAX_RPM 255 // Max RPM of your spindle - This value is equal to 100% Duty Cycle on the PWM
|
||||
#endif
|
||||
|
||||
// Advanced Configuration Below You should not need to touch these variables
|
||||
|
||||
//Set Timer up to use TIMER4 OCR4B which is attached to Digital Pin 7
|
||||
#define TCCRA_REGISTER TCCR2A
|
||||
#define TCCRB_REGISTER TCCR2B
|
||||
#define OCR_REGISTER OCR2A
|
||||
|
||||
#define COMB_BIT COM2A1
|
||||
#define WAVE0_REGISTER WGM20
|
||||
#define WAVE1_REGISTER WGM21
|
||||
#define WAVE2_REGISTER WGM22
|
||||
#define WAVE3_REGISTER WGM23
|
||||
|
||||
#define SPINDLE_PWM_DDR DDRB
|
||||
#define SPINDLE_PWM_PORT PORTB
|
||||
#define SPINDLE_PWM_BIT 3 // UNO Digital Pin 11
|
||||
|
||||
#endif // End of VARIABLE_SPINDLE
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CPU_MAP_ATMEGA2560 // (Arduino Mega 2560) Working @EliteEng
|
||||
#ifdef CPU_MAP_ATMEGA2560 // (Arduino Mega 2560) Working @EliteEng
|
||||
|
||||
// Serial port pins
|
||||
#define SERIAL_RX USART0_RX_vect
|
||||
#define SERIAL_UDRE USART0_UDRE_vect
|
||||
|
||||
// Increase Buffers to make use of extra SRAM
|
||||
#define RX_BUFFER_SIZE 256
|
||||
#define TX_BUFFER_SIZE 128
|
||||
#define BLOCK_BUFFER_SIZE 36
|
||||
#define LINE_BUFFER_SIZE 100
|
||||
//#define RX_BUFFER_SIZE 256
|
||||
//#define TX_BUFFER_SIZE 128
|
||||
//#define BLOCK_BUFFER_SIZE 36
|
||||
//#define LINE_BUFFER_SIZE 100
|
||||
|
||||
// NOTE: All step pins must be on the same port.
|
||||
#define STEPPING_DDR DDRA
|
||||
@ -121,7 +175,7 @@
|
||||
#define X_STEP_BIT 2 // MEGA2560 Digital Pin 24
|
||||
#define Y_STEP_BIT 3 // MEGA2560 Digital Pin 25
|
||||
#define Z_STEP_BIT 4 // MEGA2560 Digital Pin 26
|
||||
#define STEPPING_MASK ((1<<X_STEP_BIT)|(1<<Y_STEP_BIT)|(1<<Z_STEP_BIT)) // All step bits
|
||||
#define STEP_MASK ((1<<X_STEP_BIT)|(1<<Y_STEP_BIT)|(1<<Z_STEP_BIT)) // All step bits
|
||||
|
||||
// NOTE: All direction pins must be on the same port.
|
||||
#define DIRECTION_DDR DDRA
|
||||
@ -149,23 +203,33 @@
|
||||
#define LIMIT_PCMSK PCMSK0 // Pin change interrupt register
|
||||
#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)) // All limit bits
|
||||
|
||||
#define SPINDLE_ENABLE_DDR DDRC
|
||||
#define SPINDLE_ENABLE_PORT PORTC
|
||||
#define SPINDLE_ENABLE_BIT 2 // MEGA2560 Digital Pin 35
|
||||
// WARNING if INVERT_SPINDLE is defined the pin will be LOW(Active) on reset of controller until spindle_init() is called.
|
||||
// this should only be a very short period of time but will energise the spindle.
|
||||
// #define INVERT_SPINDLE // This will INVERT the Spindle LOW=Active
|
||||
// END WARNING
|
||||
|
||||
#define SPINDLE_DIRECTION_DDR DDRC
|
||||
#define SPINDLE_DIRECTION_PORT PORTC
|
||||
#define SPINDLE_DIRECTION_BIT 1 // MEGA2560 Digital Pin 36
|
||||
#define SPINDLE_ENABLE_DDR DDRH
|
||||
#define SPINDLE_ENABLE_PORT PORTH
|
||||
#define SPINDLE_ENABLE_BIT 3 // MEGA2560 Digital Pin 6
|
||||
|
||||
#define COOLANT_FLOOD_DDR DDRC
|
||||
#define COOLANT_FLOOD_PORT PORTC
|
||||
#define COOLANT_FLOOD_BIT 0 // MEGA2560 Digital Pin 37
|
||||
#define SPINDLE_DIRECTION_DDR DDRE
|
||||
#define SPINDLE_DIRECTION_PORT PORTE
|
||||
#define SPINDLE_DIRECTION_BIT 3 // MEGA2560 Digital Pin 5
|
||||
|
||||
// WARNING if INVERT_COOLANT is defined the pin will be LOW(Active) on reset of controller until coolant_init() is called.
|
||||
// this should only be a very short period of time but will energise the coolant pump.
|
||||
// #define INVERT_COOLANT // This will INVERT the Coolant LOW=Active
|
||||
// END WARNING
|
||||
|
||||
#define COOLANT_FLOOD_DDR DDRH
|
||||
#define COOLANT_FLOOD_PORT PORTH
|
||||
#define COOLANT_FLOOD_BIT 5 // MEGA2560 Digital Pin 8
|
||||
|
||||
// #define ENABLE_M7 // Mist coolant disabled by default. Uncomment to enable.
|
||||
#ifdef ENABLE_M7
|
||||
#define COOLANT_MIST_DDR DDRC
|
||||
#define COOLANT_MIST_PORT PORTC
|
||||
#define COOLANT_MIST_BIT 3 // MEGA2560 Digital Pin 34
|
||||
#define COOLANT_MIST_DDR DDRH
|
||||
#define COOLANT_MIST_PORT PORTH
|
||||
#define COOLANT_MIST_BIT 6 // MEGA2560 Digital Pin 9
|
||||
#endif
|
||||
|
||||
// NOTE: All pinouts pins must be on the same port and cannot be on same port as limit pins.
|
||||
@ -180,11 +244,41 @@
|
||||
#define PINOUT_PCMSK PCMSK2 // Pin change interrupt register
|
||||
#define PINOUT_MASK ((1<<PIN_RESET)|(1<<PIN_FEED_HOLD)|(1<<PIN_CYCLE_START))
|
||||
|
||||
#endif
|
||||
// Start of PWM & Stepper Enabled Spindle
|
||||
// #define VARIABLE_SPINDLE // comment this out to disable PWM & Stepper on the spindle
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
|
||||
//#define SPINDLE_IS_STEPPER // Uncomment this if your Spindle is a Stepper Motor
|
||||
#define SPINDLE_IS_PWM // Uncomment this if your Spindle uses PWM ie. DC Motor
|
||||
|
||||
#ifdef SPINDLE_IS_PWM
|
||||
#define SPINDLE_MAX_RPM 255 // Max RPM of your spindle
|
||||
#endif
|
||||
|
||||
// Advanced Configuration Below You should not need to touch these variables
|
||||
|
||||
//Set Timer up to use TIMER4 OCR4B which is attached to Digital Pin 7
|
||||
#define TCCRA_REGISTER TCCR2A
|
||||
#define TCCRB_REGISTER TCCR2B
|
||||
#define OCR_REGISTER OCR2B
|
||||
|
||||
#define COMB_BIT COM2B1
|
||||
#define WAVE0_REGISTER WGM20
|
||||
#define WAVE1_REGISTER WGM21
|
||||
#define WAVE2_REGISTER WGM22
|
||||
#define WAVE3_REGISTER WGM23
|
||||
|
||||
#define SPINDLE_PWM_DDR DDRH
|
||||
#define SPINDLE_PWM_PORT PORTH
|
||||
#define SPINDLE_PWM_BIT 6 // MEGA2560 Digital Pin 9
|
||||
|
||||
#endif // End of VARIABLE_SPINDLE
|
||||
#endif
|
||||
|
||||
/*
|
||||
#ifdef CPU_MAP_CUSTOM_PROC
|
||||
// For a custom pin map or different processor, copy and paste one of the default cpu map
|
||||
|
||||
// settings above and modify it to your needs. Then, make sure the defined name is also
|
||||
// changed in the config.h file.
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user