Make the use of the internal pullup resistors optional.

All other firmwares set them to zero -> no internal pullup resistor,
as they counter-work to the design of the electronic endstops.
However, in conjunction with mechanical endstops, they're very practical.
This commit is contained in:
Markus Hitter 2011-02-24 13:22:30 +01:00
parent 815ff7ba19
commit b7afdda3f7
5 changed files with 54 additions and 6 deletions

View File

@ -158,6 +158,12 @@ undefine if you don't want to use them
#include "arduino.h"
/*
internal pullup resistors
the ATmega has internal pullup resistors on it's input pins which are counterproductive with the commonly used eletronic endstops, so they should be switched off. For other endstops, like mechanical ones, you may want to uncomment this.
*/
//#define USE_INTERNAL_PULLUPS
/*
this is the official gen3 reprap motherboard pinout
*/

View File

@ -161,6 +161,12 @@ undefine if you don't want to use them
#include "arduino.h"
/*
internal pullup resistors
the ATmega has internal pullup resistors on it's input pins which are counterproductive with the commonly used eletronic endstops, so they should be switched off. For other endstops, like mechanical ones, you may want to uncomment this.
*/
//#define USE_INTERNAL_PULLUPS
/*
this is the official GEN6 reprap motherboard pinout
*/

View File

@ -152,6 +152,12 @@ undefine if you don't want to use them
#include "arduino.h"
/*
internal pullup resistors
the ATmega has internal pullup resistors on it's input pins which are counterproductive with the commonly used eletronic endstops, so they should be switched off. For other endstops, like mechanical ones, you may want to uncomment this.
*/
//#define USE_INTERNAL_PULLUPS
/*
user defined pins
adjust to suit your electronics,

View File

@ -161,6 +161,12 @@ undefine if you don't want to use them
#include "arduino.h"
/*
internal pullup resistors
the ATmega has internal pullup resistors on it's input pins which are counterproductive with the commonly used eletronic endstops, so they should be switched off. For other endstops, like mechanical ones, you may want to uncomment this.
*/
//#define USE_INTERNAL_PULLUPS
/*
this is the ramps motherboard pinout
*/

View File

@ -39,10 +39,18 @@ void io_init(void) {
WRITE(X_STEP_PIN, 0); SET_OUTPUT(X_STEP_PIN);
WRITE(X_DIR_PIN, 0); SET_OUTPUT(X_DIR_PIN);
#ifdef X_MIN_PIN
#ifdef USE_INTERNAL_PULLUPS
WRITE(X_MIN_PIN, 1); SET_INPUT(X_MIN_PIN);
#else
WRITE(X_MIN_PIN, 0); SET_INPUT(X_MIN_PIN);
#endif
#endif
#ifdef X_MAX_PIN
#ifdef USE_INTERNAL_PULLUPS
WRITE(X_MAX_PIN, 1); SET_INPUT(X_MAX_PIN);
#else
WRITE(X_MAX_PIN, 0); SET_INPUT(X_MAX_PIN);
#endif
#endif
#ifdef X_ENABLE_PIN
WRITE(X_ENABLE_PIN, 1); SET_OUTPUT(X_ENABLE_PIN);
@ -51,10 +59,18 @@ void io_init(void) {
WRITE(Y_STEP_PIN, 0); SET_OUTPUT(Y_STEP_PIN);
WRITE(Y_DIR_PIN, 0); SET_OUTPUT(Y_DIR_PIN);
#ifdef Y_MIN_PIN
#ifdef USE_INTERNAL_PULLUPS
WRITE(Y_MIN_PIN, 1); SET_INPUT(Y_MIN_PIN);
#else
WRITE(Y_MIN_PIN, 0); SET_INPUT(Y_MIN_PIN);
#endif
#endif
#ifdef Y_MAX_PIN
#ifdef USE_INTERNAL_PULLUPS
WRITE(Y_MAX_PIN, 1); SET_INPUT(Y_MAX_PIN);
#else
WRITE(Y_MAX_PIN, 0); SET_INPUT(Y_MAX_PIN);
#endif
#endif
#ifdef Y_ENABLE_PIN
WRITE(Y_ENABLE_PIN, 1); SET_OUTPUT(Y_ENABLE_PIN);
@ -63,10 +79,18 @@ void io_init(void) {
WRITE(Z_STEP_PIN, 0); SET_OUTPUT(Z_STEP_PIN);
WRITE(Z_DIR_PIN, 0); SET_OUTPUT(Z_DIR_PIN);
#ifdef Z_MIN_PIN
#ifdef USE_INTERNAL_PULLUPS
WRITE(Z_MIN_PIN, 1); SET_INPUT(Z_MIN_PIN);
#else
WRITE(Z_MIN_PIN, 0); SET_INPUT(Z_MIN_PIN);
#endif
#endif
#ifdef Z_MAX_PIN
#ifdef USE_INTERNAL_PULLUPS
WRITE(Z_MAX_PIN, 1); SET_INPUT(Z_MAX_PIN);
#else
WRITE(Z_MAX_PIN, 0); SET_INPUT(Z_MAX_PIN);
#endif
#endif
#ifdef Z_ENABLE_PIN
WRITE(Z_ENABLE_PIN, 1); SET_OUTPUT(Z_ENABLE_PIN);