Memorial day is 05/25/2015 – Orders will ship out on May 26th. There will not be any deliveries or shipping on Monday. Any order placed after 11am ET on Friday May 22nd will not start to ship out until Tuesday May 26th.

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

Multi-Motor Driver Shield w/ DUE

by dgelman on Thu Jan 10, 2013 7: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: 10
Joined: Thu Jan 10, 2013 7:05 pm

Re: Multi-Motor Driver Shield w/ DUE

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

Hi. This appears to be a copy of an older design of ours. You should contact the seller for support.

Posts: 37547
Joined: Sat Feb 07, 2009 10:11 am