K155id1 + 74HC595¶
Now I’ve to combine both types of chips. I would like to use 3x 74HC595
and 6x K155id1
.
wiring¶
The shift registers has to be connected as described in the shift register section
Instead of the 8 LEDs, I use 2x K155id1 per 74HC595 shift register.
connected to | 74HC595 | 74HC595 | connected to |
---|---|---|---|
K155id1 B(1) | 1 - Qb | VCC - 16 | 3V3 |
K155id1 C(1) | 2 - Qc | Qa - 15 | K155id1 A(1) |
K155id1 D(1) | 3 - Qd | SER - 14 | Arduino D2 |
K155id1 A(2) | 4 - Qe | OE - 13 | GND |
K155id1 B(2) | 5 - Qf | RCLK - 12 | Arduino D4 |
K155id1 C(2) | 6 - Qg | SRCLK - 11 | Arduino D3 |
K155id1 D(2) | 7 - Qh | SRCLR - 10 | 3V3 |
GND | 8 - GND | Qh’ - 9 | SR (2) Pin 14 |
programming¶
I used a combination of the both arduino sketches for testing.
Here is a code snippet of the header an the first two numbers.
#include <ShiftRegister74HC595.h>
const int numberOfShiftRegisters = 3; // number of shift registers attached in series
int serialDataPin = 2; // DS
int clockPin = 3; // SHCP
int latchPin = 4; // STCP
ShiftRegister74HC595<numberOfShiftRegisters> sr(serialDataPin, clockPin, latchPin);
void setup() {
}
void loop() {
//#0:
sr.set(3, LOW); //D1
sr.set(2, LOW); //C1
sr.set(1, LOW); //B1
sr.set(0, LOW); //A1
sr.set(7, LOW); //D2
sr.set(6, LOW); //C2
sr.set(5, LOW); //B2
sr.set(4, LOW); //A2
sr.set(11, LOW); //D3
sr.set(10, LOW); //C3
sr.set(9, LOW); //B3
sr.set(8, LOW); //A3
sr.set(15, LOW); //D4
sr.set(14, LOW); //C4
sr.set(13, LOW); //B4
sr.set(12, LOW); //A4
sr.set(19, LOW); //D5
sr.set(18, LOW); //C5
sr.set(17, LOW); //B5
sr.set(16, LOW); //A5
sr.set(23, LOW); //D6
sr.set(22, LOW); //C6
sr.set(21, LOW); //B6
sr.set(20, LOW); //A6
delay(100);
//#1:
sr.set(3, LOW); //D1
sr.set(2, LOW); //C1
sr.set(1, LOW); //B1
sr.set(0, HIGH); //A1
sr.set(7, LOW); //D2
sr.set(6, LOW); //C2
sr.set(5, LOW); //B2
sr.set(4, HIGH); //A2
sr.set(11, LOW); //D3
sr.set(10, LOW); //C3
sr.set(9, LOW); //B3
sr.set(8, HIGH); //A3
sr.set(15, LOW); //D4
sr.set(14, LOW); //C4
sr.set(13, LOW); //B4
sr.set(12, HIGH);//A4
sr.set(19, LOW); //D5
sr.set(18, LOW); //C5
sr.set(17, LOW); //B5
sr.set(16, HIGH);//A5
sr.set(23, LOW); //D6
sr.set(22, LOW); //C6
sr.set(21, LOW); //B6
sr.set(20, HIGH);//A6
delay(100);
The complete code can be downloaded HERE
testing¶
perfect !
Now I have to optimize the arduino code.