Dear experts,
i'm new for this forum and beg you to teach me about shiftout in this first post :).
the case is, i have 8 * 74HC595 ICs, i want 64 bits output as the result to control 64 leds at a time.
if i have int variable contain 8 * 8 bits data in array, how to shiftout these data?
is repeating shiftout of each data correct? as below:
using the shift out function should be fine if each led has its own output (course the SR cant handle all 8 on at once you need transistors, or super dim led's that will be uneven)
where I ran into speed issues was in scanning 1024 leds like a screen, you could also do scanning which would drop your sr count down to 2, people scan through 8x8 matrices all the time (thats why I had to be a jerk and scan through 16 of them lol)
if i modify my code as below, is it correct (similar result)?
Short answer - No!
If you interface to a single 16 bit shift-register (or two 8-bit shift registers) you could fit all data in a 16 bit variable and do as follows:
unsigned int data;
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, (byte)data); // shift out low byte
shiftOut(dataPin, clockPin, LSBFIRST, (byte)(data>>8)); // shift out high byte
digitalWrite(latchPin, HIGH);
Using an array as you do is just fine - keep it as is.
In your code, myData is defined as an array of eight 16-bit values. Since you only need eight 8-bit values you should change the data type from int (16-bit) to byte (8-bit).