Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Firmware is working. Settings have not been adjusted.

  • Loading branch information...
commit 13f4d97e46f680bab509f190664caefe7e78f9d5 1 parent 29beb0a
@timkrins authored
Showing with 25 additions and 8 deletions.
  1. +1 −0  Makefile
  2. +12 −5 config.h
  3. +7 −1 settings.c
  4. +5 −2 stepper.c
View
1  Makefile
@@ -57,6 +57,7 @@ all: grbl.hex
flash: grbl.hex
$(AVRDUDE) -cusbtiny -p$(DEVICE) -V -U flash:w:$^
+ rm -f grbl.hex main.elf $(OBJECTS)
fuse:
$(AVRDUDE) $(FUSES)
View
17 config.h
@@ -35,6 +35,10 @@
#define STEPPERS_ENABLE_PORT PORTC
#define STEPPERS_ENABLE_BIT 3 //PC3
+#define STEPPERS_RESET_DDR DDRC
+#define STEPPERS_RESET_PORT PORTC
+#define STEPPERS_RESET_BIT 4 //PC4
+
#define STEPPING_DDR DDRC
#define STEPPING_PORT PORTC
#define X_STEP_BIT 5 //PC5
@@ -44,11 +48,14 @@
#define Y_DIRECTION_BIT 1 //PC1
#define Z_DIRECTION_BIT 0 //PC0
-#define LIMIT_DDR DDRA
-#define LIMIT_PORT PORTA
-#define X_LIMIT_BIT 1
-#define Y_LIMIT_BIT 2
-#define Z_LIMIT_BIT 3
+//as a default it goes 11000000.
+//when X is going down, 11100000.
+
+//#define LIMIT_DDR DDRA
+//#define LIMIT_PORT PORTA
+//#define X_LIMIT_BIT 1
+//#define Y_LIMIT_BIT 2
+//#define Z_LIMIT_BIT 3
#define SPINDLE_ENABLE_DDR DDRB
#define SPINDLE_ENABLE_PORT PORTB
View
8 settings.c
@@ -54,7 +54,13 @@ void settings_reset() {
}
void settings_dump() {
- printPgmString(PSTR("$0 = ")); printFloat(settings.steps_per_mm[X_AXIS]);
+ printPgmString(PSTR("PortC")); printInteger(PORTC);
+ // printPgmString(PSTR("\r\nPortA")); printInteger(PORTA);
+ // printPgmString(PSTR("\r\nPortB")); printInteger(PORTB);
+ printPgmString(PSTR("\r\nddrC")); printInteger(DDRC);
+ // printPgmString(PSTR("\r\nddrA")); printInteger(DDRA);
+ // printPgmString(PSTR("\r\nddrB")); printInteger(DDRB);
+ printPgmString(PSTR("\r\n$0 = ")); printFloat(settings.steps_per_mm[X_AXIS]);
printPgmString(PSTR(" (steps/mm x)\r\n$1 = ")); printFloat(settings.steps_per_mm[Y_AXIS]);
printPgmString(PSTR(" (steps/mm y)\r\n$2 = ")); printFloat(settings.steps_per_mm[Z_AXIS]);
printPgmString(PSTR(" (steps/mm z)\r\n$3 = ")); printInteger(settings.pulse_microseconds);
View
7 stepper.c
@@ -37,7 +37,7 @@
#define STEP_MASK ((1<<X_STEP_BIT)|(1<<Y_STEP_BIT)|(1<<Z_STEP_BIT)) // All step bits
#define DIRECTION_MASK ((1<<X_DIRECTION_BIT)|(1<<Y_DIRECTION_BIT)|(1<<Z_DIRECTION_BIT)) // All direction bits
#define STEPPING_MASK (STEP_MASK | DIRECTION_MASK) // All stepping-related bits (step/direction)
-#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)) // All limit bits
+//#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)) // All limit bits
#define TICKS_PER_MICROSECOND (F_CPU/1000000)
#define CYCLES_PER_ACCELERATION_TICK ((TICKS_PER_MICROSECOND*1000000)/ACCELERATION_TICKS_PER_SECOND)
@@ -212,8 +212,9 @@ void st_init()
// Configure directions of interface pins
STEPPING_DDR |= STEPPING_MASK;
STEPPING_PORT = (STEPPING_PORT & ~STEPPING_MASK) | settings.invert_mask;
- LIMIT_DDR &= ~(LIMIT_MASK);
+ //LIMIT_DDR &= ~(LIMIT_MASK);
STEPPERS_ENABLE_DDR |= 1<<STEPPERS_ENABLE_BIT;
+ STEPPERS_RESET_DDR |= 1<<STEPPERS_RESET_BIT;
// waveform generation = 0100 = CTC
TCCR1B &= ~(1<<WGM13);
@@ -236,6 +237,8 @@ void st_init()
// set enable pin
//STEPPERS_ENABLE_PORT |= 1<<STEPPERS_ENABLE_BIT;
+ STEPPERS_ENABLE_PORT |= 0<<STEPPERS_ENABLE_BIT;
+ STEPPERS_RESET_PORT |= 1<<STEPPERS_RESET_BIT;
sei();
}
Please sign in to comment.
Something went wrong with that request. Please try again.