chipKIT® Development Platform

Inspired by Arduino™

AccelStepperH library makes pin 43 go high!?

Created Mon, 03 Feb 2014 16:53:20 +0000 by palmhoej


palmhoej

Mon, 03 Feb 2014 16:53:20 +0000

Okay so im working on this automation project and using the AccelStepperH library on my Chipkit Max32 to control some steppers and some pneumatic actuators.

The library works fine and the motor are spinning, but every time it changes direction (dir = pin 51), pin 43 goes high, making my pneumatic actuator go forward.

Is there a connection between pin 43 and 51 i don't know about? Or is there something in the library that make pin 43 go high?

I can solve the problem by writing digitalWrite(43, LOW) in the loop , but this is not an acceptable situation, because sometimes it needs to go high as well

#include <AccelStepper.h>

// Define (unipolar=1 Bipolar=2 ,  step  , dir)
AccelStepper stepper(1, 50, 51);

int pos = 1000;

void setup()
{  
  stepper.setMinPulseWidth(3);
  stepper.setMaxSpeed(6000);
  stepper.setAcceleration(6000);
}

void loop()
{

  if (stepper.distanceToGo() == 0)
  {

    delay(2000);
    pos = -pos;
    stepper.moveTo(pos);
  }
  stepper.run();
}

Ian_B

Mon, 03 Feb 2014 19:36:05 +0000

Pins 51 and 43 on the Max32 are physically tied together through jumper JP4. They share the same signal pin on the PIC32. You can check this on the pinout table in the Max32 reference manual at [url]http://www.digilentinc.com[/url].

By moving JP3 and JP4 from the "MASTER" position to "SLAVE," you can swap pins 50 and 51. These pins are used as the primary SPI interface on the Max32.