From 27c3932cacee60ae5da1f2d7ac0d56de634898bd Mon Sep 17 00:00:00 2001 From: ieguiguren Date: Fri, 7 Jun 2019 23:46:22 +0200 Subject: [PATCH] Defined the bits for CNC Shield v4 which has direction and steps interchanged In the CNC Shield v4 which is for the Arduino nano, the bits for direction are 2,3 and 4. The same way, the bits for step are 5,6 and 7. Uncommenting the definition for CNC_SHIELD_V4 or --- grbl/cpu_map.h | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/grbl/cpu_map.h b/grbl/cpu_map.h index 0e2b25e5..49d9a252 100644 --- a/grbl/cpu_map.h +++ b/grbl/cpu_map.h @@ -26,27 +26,42 @@ #ifndef cpu_map_h #define cpu_map_h - #ifdef CPU_MAP_ATMEGA328P // (Arduino Uno) Officially supported by Grbl. - // Define serial port pins and interrupt vectors. +// Uncomment to use a CNC SHIELD v4, the one for arduino nano +// #define CNC_SHIELD_V4 + +// Define serial port pins and interrupt vectors. #define SERIAL_RX USART_RX_vect #define SERIAL_UDRE USART_UDRE_vect // Define step pulse output pins. NOTE: All step bit pins must be on the same port. #define STEP_DDR DDRD #define STEP_PORT PORTD - #define X_STEP_BIT 2 // Uno Digital Pin 2 - #define Y_STEP_BIT 3 // Uno Digital Pin 3 - #define Z_STEP_BIT 4 // Uno Digital Pin 4 + #ifndef CNC_SHIELD_V4 // has traces for step and direction interchanged + #define X_STEP_BIT 2 // Uno Digital Pin 2 + #define Y_STEP_BIT 3 // Uno Digital Pin 3 + #define Z_STEP_BIT 4 // Uno Digital Pin 4 + #else + #define X_STEP_BIT 5 // nano Digital Pin 5 + #define Y_STEP_BIT 6 // nano Digital Pin 6 + #define Z_STEP_BIT 7 // nano Digital Pin 7 + #endif #define STEP_MASK ((1<