Multi-Motor Driver Shield w/ DUE
Moderators: adafruit_support_bill, adafruit

Multi-Motor Driver Shield w/ DUE

by dgelman on Thu Jan 10, 2013 6:18 pm

Hello Community,

I have been playing with the UNO for a while now and now I have switched to the DUE. I have the following shield the can potentially control 4 DC motors.

The shield comes with a library that is strictly for AVR Arduinos (everything but the DUE), so the library is useless. Trying to decypher the language, I understand that it is using a latch to trigger forward and reverse current (via shift register). I know where to send the PWM just not the control of direction...

My previous designs required me to send states that would direct the polarity of the current to provide the reversing or forwarding of the motors. Now this shield uses a shift register and direct latch. This confusion along with my limited understand of ARM is making this difficult for me to understand.

Notice the "~_BV(a);" and "_BV(b);" and its variations that all polarity in the current.

From Library of Shield
Code: Select all | TOGGLE FULL SIZE
void AF_DCMotor::run(uint8_t cmd) {
  uint8_t a, b;
  switch (motornum) {
  case 1:
    a = MOTOR1_A; b = MOTOR1_B; break;
  case 2:
    a = MOTOR2_A; b = MOTOR2_B; break;
  case 3:
    a = MOTOR3_A; b = MOTOR3_B; break;
  case 4:
    a = MOTOR4_A; b = MOTOR4_B; break;
  switch (cmd) {
  case FORWARD:
    latch_state |= _BV(a);
    latch_state &= ~_BV(b);
  case BACKWARD:
    latch_state &= ~_BV(a);
    latch_state |= _BV(b);
  case RELEASE:
    latch_state &= ~_BV(a);
    latch_state &= ~_BV(b);

I hope this isnt to vague of a question. Please let me know if this is confusing.

Posts: 7
Joined: Thu Jan 10, 2013 6:05 pm

Re: Multi-Motor Driver Shield w/ DUE

by adafruit_support_bill on Thu Jan 10, 2013 6:31 pm

Hi. This appears to be a copy of an older design of ours. You should contact the seller for support.
User avatar
Posts: 29009
Joined: Sat Feb 07, 2009 9:11 am