16 Bit ShiftOut() with a6279 allegro driver

I am having issues using the arduino shiftout() function with an allegro 16bit led driver. I'd like to make a single function call, to light LEDs on all pins. As think I understand it, I need to latch low, make two 8 bit shiftout() calls then latch high again, to accomplish sending 16bits of data to the a6279 chip. Is this a wrong interpretation?

Here is the code. I've also included a commented out for loop, that is supposed to be used used to cycle through 8 bits. I tried to repurpose it to cycle through combinations of 2 8bit sets of data. I could not detect that any voltage was being supplied to the led pins of the driver. I've tested my leds and verified the led driver is properly powered.

Any help, would be much appreciated. - Ben

/******************************************************************

******************************************************************/

int latchPin = 8;
int clockPin = 12;
int dataPin = 11;

void setup() {
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}

void loop() {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, B11111111);
shiftOut(dataPin, clockPin, MSBFIRST, B11111111);
digitalWrite(latchPin, HIGH);
delay(500);

/* for (int j = 0; j < 256; j++) {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, j);
shiftOut(dataPin, clockPin, MSBFIRST, j);
digitalWrite(latchPin, HIGH);
delay(500);
}*/
}

As think I understand it, I need to latch low, make two 8 bit shiftout() calls then latch high again, to accomplish sending 16bits of data to the a6279 chip. Is this a wrong interpretation?

That sounds right.

I could not detect that any voltage was being supplied to the led pins of the driver.

This device has sinking outputs, if 0xFFFF turns them "on" (I don't know if it does but maybe) then you will read 0v, try sending 0x0000.

I've also included a commented out for loop, that is supposed to be used used to cycle through 8 bits.

So why do you have

j < 256

BTW this is a discontinued device, I wouldn't use it for a product but OK for mucking around.


Rob

Thanks Rob,
the 256 portion was taken from an 8x8 led library. I wanted to see how they use the shiftout() function with two different 8bit led drivers. Just included it it, since it was my roadmap to generally understanding shiftout. 256 is the decimal representation of an 8 bit binary, so it should have stepped through the entire combination of leds. If it was directly applicable to my application I should have seen some combinations of pins light up.

So I took your advice. I tested 0xFFFF and 0xFF.

I also tested 0xFFFF with a single shiftout() call, since FFFF = 1111111111111111 which is 16 bits? as I understood the shiftout() function, it only handles 8 bits, which is why two calls are needed for more than 1 8 bit shift register, or in my case a single 16 bit register?

Tried / Failed
shiftOut(dataPin, clockPin, MSBFIRST, 0xffff);

Tried / Failed
shiftOut(dataPin, clockPin, MSBFIRST, 0xffff);
shiftOut(dataPin, clockPin, MSBFIRST, 0xffff);

Tried / Failed
shiftOut(dataPin, clockPin, MSBFIRST, 0xff);
shiftOut(dataPin, clockPin, MSBFIRST, 0xff);

So.... I'm wondering. The shiftout() toggles the clockpin at the end of 8bits. Is this a problem sending to a 16 bit shiftregister? Should I rewrite the shiftout function, rename it, IE uint8_t to uint16_t, etc?

Thanks so much, the help is really appreciated. As far as discontinued parts. This isn't any sort of product, just one off led lighting project to germinate difficult seedlings indoors, before moving outside.

which is 16 bits? as I understood the shiftout() function, it only handles 8 bits,

That's correct, when I say 0xFFFF I assume you will do two 8-bit shifts as you have been doing.

I also said

try sending 0x0000.

Did you try that?

The shiftout() toggles the clockpin at the end of 8bits.

It does of course use the clockpin or no data will be clocked into the external device, but doesn't touch the latchpin.

This isn't any sort of product, just one off led lighting project

Then I'd buy a few spares in case a chip dies in 2 years time.


Rob

Okay... Hmmm.

I tried 0x0000, and I tried all the combinations 0x0000 and 0xFFFF with MSBFIRST and LSBFIRST with no success. I wonder if I need to take a better look at the data sheet. I'm fairly certain I am wired correctly, but re-checking again probably couldn't hurt. Unless you have other ideas?! :frowning:

I wonder if I should just get two 74hc164 8 bit shift registers like all the other led projects on the web. ...

I'm fairly certain I am wired correctly, but re-checking again probably couldn't hurt.

It never hurts, we all do similar, "knowing" that it's right, I've looked at things for hours and had a work mate peer over my shoulder and say something like "Shouldn't the red wire be on pin 2?".

For the record you should have the following

A6279 pin
Serial data in (2) ----- dataPin
Clock (3) -------------- clockPin
Output enable (21) --- NC or 5v
Latch enable (4) ------ latchPin

I wonder if I should just get two 74hc164 8 bit shift registers like all the other led projects on the web. ...

This chip is little more than a simple shift register, if you can't get it working you probably won't get a '164 working either. And normal shift registers aren't really designed to drive LEDs.

EDIT: I just thought, these outputs ate open collector/drain, when they are off you won't see any voltage because they are floating. Either put a LED in or pull up a pin with a resistor then see if it works with both 0x0000 and 0xFFFF.


Rob

Rob, Thank you for all your help.

I revisited my hardware, and wiring. I am embarrassed to admit it, almost too much so to post, but my wiring was wrong. My sole reason for posting is in hope that it will help others working with a single 16 bit shift register, which isn't nearly as well documented as 8 bit and tethering devices. The documentation for shiftout() wasn't 100% clear at the beginning, but is now; as are my a6279 led driver specs.

This code works perfectly.

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 0xFFFF);
shiftOut(dataPin, clockPin, MSBFIRST, 0xFFFF);
digitalWrite(latchPin, HIGH);

So long as you push the desired amount of bits before latching high again, its good.

Rob thanks again.

Ok, job done.


Rob