Step motor driver basic questions

Hi,

I'm waiting the delivery of a NEMA23 and TB6600 driver and I have some question to drive it.

1- First of all, there is a pin 'Enable' on the driver. I can't really understand and find on internet what is for ? If I 'don't send anything more than a HIGH signal on the pin attached to the 'Enable' what it will do ? Lock the position ?

2- To control the rotation speed you basically need to change the delay() after stepPin HIGH stepPin HIGH in the loop. Does it means that we can go 150 000tr/min ? I know it's not possible but how do we know the max speed of the motor we have ?

3- If found here this code :

#define RPMS                104.0
#define STEP_PIN                9
#define DIRECTION_PIN           8
#define GO_PIN                  3

#define STEPS_PER_REV         200
#define MICROSTEPS_PER_STEP     8
#define MICROSECONDS_PER_MICROSTEP   (1000000/(STEPS_PER_REV * MICROSTEPS_PER_STEP)/(RPMS / 60))

uint32_t LastStepTime = 0;
uint32_t CurrentTime = 0;

void setup() {                
  pinMode(STEP_PIN, OUTPUT);     
  pinMode(DIRECTION_PIN, OUTPUT);
  digitalWrite(STEP_PIN, LOW);
  digitalWrite(DIRECTION_PIN, LOW);
  pinMode(GO_PIN,INPUT);
}

void loop() {
  if (digitalRead(GO_PIN) == LOW)
  {
    CurrentTime = micros();
    if ((CurrentTime - LastStepTime) > MICROSECONDS_PER_MICROSTEP)
    {
      LastStepTime = CurrentTime;
      digitalWrite(STEP_PIN, HIGH);
      delayMicroseconds((MICROSECONDS_PER_MICROSTEP * 0.9)/2);
      digitalWrite(STEP_PIN, LOW); 
      delayMicroseconds((MICROSECONDS_PER_MICROSTEP * 0.9)/2);
    }
  }
}

This is more or less what I want to do but I don't understand why they are testing the current time and last step time... Is it to make sure the axis has moved and we don't send a new order before the axis arrived to the correct position ?

4-Does it exist a library to simplify the code above ? I can't find the info if the Stepper.h library works with drivers ?

Thank you for your help.

The enable pin probably disables the power to the motors to save energy or allow the motors to me moved by an external force (such as your hand). For many drivers there is no need to connect to the enable pin if you have no need to disable the driver - but you need to check the datasheet for your particular driver board. Also, some need a HIGH to disable the motors and others need a LOW, so you may need to experiment.

This Simple Stepper Code may illustrate the speed control more clearly. There is a distinction between the length of a step pulse, which is short and need not change, and the interval between steps that controls the speed. Always start testing with very low speeds - say 10 steps per second.

...R
Stepper Motor Basics