Source

CNC Controller / configMe.h

// ---------------------------------------------------------------------------
// Created by F. Malpartida on 9/9/12.
// Copyright 2011 - Under creative commons license 3.0:
//        Attribution-NonCommercial-ShareAlike CC BY-NC-SA
//        http://www.electrofunltd.com
//
// This software is furnished "as is", without technical support, and with no
// warranty, express or implied, as to its usefulness for any purpose.
//
// Thread Safe: No
// Extendable: No
//
// @file configMe.h
// Main application configuration file.
//
// @brief Main machine configuration information.
// Main configuration information:
// rod feed, feed rates, pin layout.
// All pins are configured for the CNC stepper shield from electroFUN LTD:
// ELFSHL1.
//
// Acknowledgements:
// Inspired in the work of Carlos guilarte y diego colonnello (Txapuzas CNC).
//
// @author F. Malpartida
// ---------------------------------------------------------------------------
#ifndef _CONFIG_ME_H_
#define _CONFIG_ME_H_


#define FRMW_VERSION "1.0.4"

// FEATURE CONFIGURATION
// ---------------------------------------------------------------------------
/*!
 @defined    _MMI_ENABLED_
 @abstract   Enables the builtin MMI system controller.
 @discussion Enables the builtin MMI. If _MMI_ENABLED_ is not commented out
 the built in MMI will be compiled in. Displays on an LCD the current position, 
 temperature and fan speed. To be used with ELFSHL1 by default.
 
 (ENABLE ME) by removing the comment of the define.
 */
#define _MMI_ENABLED_

/*!
 @defined    _TEMP_CONTROL_ENABLED_
 @abstract   Enables the builtin temperature controller.
 @discussion Enables the builtin temperature controller of the entire assembly.
 Monitoring the temperature and controlling a fan to keep the electronics at the
 configured temperature range. To be used with ELFSHL1 by default.

 (ENABLE ME) by removing the comment of the define.
 */
#define _TEMP_CONTROL_ENABLED_


// CONTANT DEFINITIONS AND MACROS
// ---------------------------------------------------------------------------
// Stepper motor enable and disable values
#define ENABLE          0
#define DISABLE         1

// Serial gcode input buffer size
#define COMMAND_SIZE (128)

#define MAX(A,B)   ( (A) > (B) ) ? (A) : (B)


// THREAD CONFIGURATON - machine parameters
// ---------------------------------------------------------------------------
#define MM_PER_INCH      (25.4)
#define MM               (1.0)

/*!
 @defined    MICRO_STEP
 @abstract   Stepper driver micro stepping.
 @discussion Stepper driver micro stepping configuration:
 1: 1    step
 2: 1/2  step
 4: 1/4  step
 8: 1/8  step
 16: 1/16 step
 Default configuration (1/8).
 
 TO BE CONFIGURED for each machine and stepper. (CONFIG ME)
 */
#define MICRO_STEP       (8)

// Values scalled by 100
#define SCALE_STEPS      (100)


// Steps per mm of different rods and stepper configurations for 200 step stepper.
// M8 - 1.25mm per revolution - 360º/1.25 -> 288º = 1mm; (288º/1.8º)
// M10 - 1.50mm per revolution - 360º/1.50 -> 240º = 1mm; (240º/1.8º)
#define M10_200              (133.3333)
#define M8_200               (160.0)


/*!
 @defined    ROD_CONF_X, ROD_CONF_Y, ROD_CONF_Y
 @abstract   Current machine rod configuration
 @discussion Machine rod configuration for each of the axis. Defaults to M10 rod
 thread and 200 step per revolution stepper motor.
 
 TO BE CONFIGURED for each machine. (CONFIG ME)
 */
#define ROD_CONF_X    (M10_200)
#define ROD_CONF_Y    (M10_200)
#define ROD_CONF_Z    (M10_200)


/*!
 @defined
 @abstract   Thread movement configuration for each axis. In steps per mm.
 @discussion Threaded rod configuration calculations ( rod steps per mm * step scale *
 micro stepping
 */
#define X_STEPS_PER_MM   ( ROD_CONF_X * SCALE_STEPS * MICRO_STEP )
#define X_STEPS_PER_INCH (X_STEPS_PER_MM * MM_PER_INCH)

#define Y_STEPS_PER_MM   ( ROD_CONF_Y * SCALE_STEPS * MICRO_STEP )
#define Y_STEPS_PER_INCH (Y_STEPS_PER_MM * MM_PER_INCH)


#define Z_STEPS_PER_MM   ( ROD_CONF_Z * SCALE_STEPS * MICRO_STEP )
#define Z_STEPS_PER_INCH (Z_STEPS_PER_MM * MM_PER_INCH)



/*!
 @defined
 @abstract   Maximum feed rate capabilities.
 @discussion Maximum X, Y and Z feed rate capabilities, this is defined in
 mm/min (mm per minute). A motion would require generating 4500/60*STEPS_PER_MM
 = steps per second This is a parameter that needs to be tunned for optimum
 operation of axis movement. Very dependent on motor and stepper motor
 driver supply.
 
 TO BE TUNNED PER MACHINE. (CONFIG ME)
 */
#define FAST_XY_FEEDRATE 3500
#define FAST_Z_FEEDRATE  3500

// Units in curve section

#define CURVE_SECTION_MM 0.5
#define CURVE_SECTION_INCHES (CURVE_SECTION_MM / MM_PER_INCH)

// Set to one if sensor outputs inverting (ie: 1 means open, 0 means closed)
// RepRap opto endstops are *not* inverting.
#define SENSORS_INVERTING 0

// How many temperature samples to take.  each sample takes about 100 usecs.


// Pin assignement
// ---------------------------------------------------------------------------
/*!
 @defined
 @abstract   Pin assignement for driving stepper motor.
 @discussion Pin assignement for all axis and control. Pin 0 indicates, no
 pin assigned. Pin configuration default to ELFDRV1, ELFDRV2 drivers mounted
 on ELFSHL1 (Stepper driver shield).
 
 TO BE CONFIGURED FOR EACH CONTROLLER. (CONFIG ME)
 */

// X axis configuration
#define X_STEP_PIN      5  // Step control PIN.
#define X_DIR_PIN       6  // Direction control PIN.
#define X_MIN_PIN       0  // min detection switch PIN
#define X_MAX_PIN       0  // max detection switch PIN
#define X_ENABLE_PIN    12 // Driver enable pin

#define Y_STEP_PIN      7  // Step control PIN.
#define Y_DIR_PIN       8  // Direction control PIN.
#define Y_MIN_PIN       0  // min detection switch PIN
#define Y_MAX_PIN       0  // max detection switch PIN
#define Y_ENABLE_PIN    12 // Driver enable pin

#define Z_STEP_PIN      9  // Step control PIN.
#define Z_DIR_PIN       10 // Direction control PIN.
#define Z_MIN_PIN       0  // min detection switch PIN
#define Z_MAX_PIN       0  // max detection switch PIN
#define Z_ENABLE_PIN    12 // Driver enable pin


#define MOTOR_PIN        0 // Spindle motor control pin

#define LCD_BL_PIN      13 // LCD backlight control pin
#define FAN_PIN         11 // Fan control pin


// Temperature control constants for fan speed
// ---------------------------------------------------------------------------
#define MAX_SPEED      255   // Maximum fan speed
#define MAX_TEMP       35.0  // Maximum temperature for full speed fan speed
#define START_TEMP     25.0  // Minimum temperature for fan to start control.


#define FILTER_ALP     0.25  // Low pass filter for temperature readings

#endif
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.