ShiftOut for DUE, what is it i'm missing here?

Hi guys, another Q for my DUE

This bit of code works fine on a UNO but not on my DUE, why?

First, this is just some test code. I’m driving a 16 bit LED shift register , on the UNO it steps from 0 to 15. Notice the Remarked code //bitClear (testing[intByte],numberToDisplay); - this works fine on the UNO. its only REM out for the DUE

On the DUE, I would expect this code to work the same as the UNO, but it does not.

First I had to change the BitClear to bitWrite (testing[intByte],numberToDisplay,0); to get it to show up any LEDs and when the LEDs light they are sort of random.

What am I missing here?

The registers are MBI5026GN

void loop() {
for(int intByte =0; intByte<2; intByte++){

for (int numberToDisplay = 0; numberToDisplay < 8; numberToDisplay++) {

// take the latchPin High so
// the LEDs don't change while you're sending in bits:

bitWrite (testing[intByte],numberToDisplay,1);

for (int shifting = 1; shifting < 3; shifting ++){

digitalWrite(OE, HIGH);

digitalWrite(LE, HIGH);

shiftOut(dataPin, clockPin, MSBFIRST, testing[shifting]);
}
//take the latch pin LOW so the LEDs will light up:

digitalWrite(LE, LOW);

digitalWrite(OE, LOW);

// pause before next value:

delay(300);

bitWrite (testing[intByte],numberToDisplay,0);

//bitClear (testing[intByte],numberToDisplay);

}
}
}

Hi guys, another Q for my DUE

So, you STILL haven't figured out that there is a DUE section for DUE questions?

Missing...

  1. The code tag which will make the forum format your code properly
  2. The definition of bitWrite(). Is this #included from a library or what?
  3. The declarations of your variables

I know this might seem like 'beat up the newbie day' when the first two replies are telling you how to post in the forum but I did try to read the code and I can't work out what it's doing or why it would fail on a Due and not a Uno.

As a guess, I would say that "LEDs light but random" might be because of the different size int on the Due.

Hi, can you post all of your sketch, we need to see what libraries you are using and how you have assigned variable types and values.

Thanks...Tom....... :slight_smile:

Thanks for the replys – and yes been on this site for 24 hours, does feel a little like” Hate Newbies” but everyone is a Newbie at some point. Sure a few more posts and I will know my way around.

More importantly

Resolved, The problem was not with the code, even though I did have a flaw in the code I posted.
The problem is that I was supplying 5 v (VDD) to the shift register and the SDI requirements is no less than .8 x VDD. So change the VDD to 3.3 V and it works.

Hence why it worked with UNO and not DUE

Glad I decided to check out the outputs on my oscilloscope, that's what made me see the true!!