gnea\grbl-Mega
1.0f
Source Code Documentation ( Internal Workings )
cpu_map.h
Go to the documentation of this file.
1
/*
2
cpu_map.h - CPU and pin mapping configuration file
3
Part of Grbl
4
5
Copyright (c) 2012-2016 Sungeun K. Jeon for Gnea Research LLC
6
7
Grbl is free software: you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation, either version 3 of the License, or
10
(at your option) any later version.
11
12
Grbl is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
16
17
You should have received a copy of the GNU General Public License
18
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
19
*/
20
25
#ifndef cpu_map_h
26
#define cpu_map_h
27
28
29
#ifdef CPU_MAP_2560_INITIAL
30
31
// Serial port interrupt vectors
32
#define SERIAL_RX USART0_RX_vect
33
#define SERIAL_UDRE USART0_UDRE_vect
34
35
// Define step pulse output pins.
37
#define STEP_DDR DDRA
38
#define STEP_PORT PORTA
39
#define STEP_PIN PINA
40
#define X_STEP_BIT 2
41
#define Y_STEP_BIT 3
42
#define Z_STEP_BIT 4
43
#define STEP_MASK ((1<<X_STEP_BIT)|(1<<Y_STEP_BIT)|(1<<Z_STEP_BIT))
44
45
// Define step direction output pins.
47
#define DIRECTION_DDR DDRC
48
#define DIRECTION_PORT PORTC
49
#define DIRECTION_PIN PINC
50
#define X_DIRECTION_BIT 7
51
#define Y_DIRECTION_BIT 6
52
#define Z_DIRECTION_BIT 5
53
#define DIRECTION_MASK ((1<<X_DIRECTION_BIT)|(1<<Y_DIRECTION_BIT)|(1<<Z_DIRECTION_BIT))
54
55
// Define stepper driver enable/disable output pin.
56
#define STEPPERS_DISABLE_DDR DDRB
57
#define STEPPERS_DISABLE_PORT PORTB
58
#define STEPPERS_DISABLE_BIT 7
59
#define STEPPERS_DISABLE_MASK (1<<STEPPERS_DISABLE_BIT)
60
61
// Define homing/hard limit switch input pins and limit interrupt vectors.
62
//
64
#define LIMIT_DDR DDRB
65
#define LIMIT_PORT PORTB
66
#define LIMIT_PIN PINB
67
#define X_LIMIT_BIT 4
68
#define Y_LIMIT_BIT 5
69
#define Z_LIMIT_BIT 6
70
#define LIMIT_INT PCIE0
71
#define LIMIT_INT_vect PCINT0_vect
72
#define LIMIT_PCMSK PCMSK0
73
#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT))
74
75
// Define spindle enable and spindle direction output pins.
76
#define SPINDLE_ENABLE_DDR DDRH
77
#define SPINDLE_ENABLE_PORT PORTH
78
#define SPINDLE_ENABLE_BIT 3
79
#define SPINDLE_DIRECTION_DDR DDRE
80
#define SPINDLE_DIRECTION_PORT PORTE
81
#define SPINDLE_DIRECTION_BIT 3
82
83
// Define flood and mist coolant enable output pins.
84
#define COOLANT_FLOOD_DDR DDRH
85
#define COOLANT_FLOOD_PORT PORTH
86
#define COOLANT_FLOOD_BIT 5
87
#define COOLANT_MIST_DDR DDRH
88
#define COOLANT_MIST_PORT PORTH
89
#define COOLANT_MIST_BIT 6
90
91
// Define user-control CONTROLs (cycle start, reset, feed hold) input pins.
92
//
94
#define CONTROL_DDR DDRK
95
#define CONTROL_PIN PINK
96
#define CONTROL_PORT PORTK
97
#define CONTROL_RESET_BIT 0
98
#define CONTROL_FEED_HOLD_BIT 1
99
#define CONTROL_CYCLE_START_BIT 2
100
#define CONTROL_SAFETY_DOOR_BIT 3
101
#define CONTROL_INT PCIE2
102
#define CONTROL_INT_vect PCINT2_vect
103
#define CONTROL_PCMSK PCMSK2
104
#define CONTROL_MASK ((1<<CONTROL_RESET_BIT)|(1<<CONTROL_FEED_HOLD_BIT)|(1<<CONTROL_CYCLE_START_BIT)|(1<<CONTROL_SAFETY_DOOR_BIT))
105
106
// Define probe switch input pin.
107
#define PROBE_DDR DDRK
108
#define PROBE_PIN PINK
109
#define PROBE_PORT PORTK
110
#define PROBE_BIT 7
111
#define PROBE_MASK (1<<PROBE_BIT)
112
113
// Advanced Configuration Below You should not need to touch these variables
114
// Set Timer up to use TIMER4B which is attached to Digital Pin 7
115
#define SPINDLE_PWM_MAX_VALUE 1024.0
116
#ifndef SPINDLE_PWM_MIN_VALUE
117
#define SPINDLE_PWM_MIN_VALUE 1
118
#endif
119
#define SPINDLE_PWM_OFF_VALUE 0
120
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
121
#define SPINDLE_TCCRA_REGISTER TCCR4A
122
#define SPINDLE_TCCRB_REGISTER TCCR4B
123
#define SPINDLE_OCR_REGISTER OCR4B
124
#define SPINDLE_COMB_BIT COM4B1
125
126
// 1/8 Prescaler, 16-bit Fast PWM mode
127
#define SPINDLE_TCCRA_INIT_MASK ((1<<WGM40) | (1<<WGM41))
128
#define SPINDLE_TCCRB_INIT_MASK ((1<<WGM42) | (1<<WGM43) | (1<<CS41))
129
#define SPINDLE_OCRA_REGISTER OCR4A
130
#define SPINDLE_OCRA_TOP_VALUE 0x0400
131
132
// Define spindle output pins.
133
#define SPINDLE_PWM_DDR DDRH
134
#define SPINDLE_PWM_PORT PORTH
135
#define SPINDLE_PWM_BIT 4
136
137
#endif
138
148
#define STEP_PORT_SET(i) STEP_PORT=i
149
#define DIRECTION_PORT_SET(i) DIRECTION_PORT=i
150
151
#endif
grbl
cpu_map.h
Generated by
1.8.10