Back to engineering archive

Record 063 / Firmware and control

Deterministic motor step sequence

Motor movement arranged as an explicit sequence of timed steps.

Firmware module
Motor controlSequencingTiming

Firmware flow

How the step pulse sequence runs

Selected motor step-pulse loop.

For each requested step, raise the step pin, wait for the pulse interval, lower it and wait for the configured low interval. Repeat until the requested count is reached.

There is no acceleration profile, position feedback or measured timing guarantee in this excerpt. The high-pulse delay and low-period delay are separate, so the total cycle includes both.

Read the implementation

stepMove pulse-loop excerpt · selected source lines 36–42. Source inspection is not a hardware test.

  for (long i = 0; i < steps; i++) {
    digitalWrite(STEP_PIN, HIGH);
    delayMicroseconds(STEP_PULSE_US);
    digitalWrite(STEP_PIN, LOW);
    // Keep overall step rate controlled:
    delayMicroseconds(STEP_PERIOD_US);
  }
Open the exact source-level diagram
Action · YesRaise the step output
Result · NoFinish the pulse sequence
ActionHold it for the pulse delay
ActionLower the output and wait
Engineering archiveArchive record

Project enquiries

Discuss your project.

Tell us what you’re developing and where you need engineering support.

Discuss your project