Open GoogleCodeExporter opened 9 years ago
// SHIFT_DATA_PIN (PC0 is analog 0) = '595 SER pin (Pin 14)
#define SHIFT_DATA_PORT PORTC
#define SHIFT_DATA_PIN PC0
#define SHIFT_DATA_DDR DDRC
// SHIFT_CLK_PIN (PC1 is analog 1) = '595 SRCLK (Pin 11)
#define SHIFT_CLK_PORT PORTC
#define SHIFT_CLK_PIN PC1
#define SHIFT_CLK_DDR DDRC
// '595 RCLK is hooked to tlc XLAT pin (Arduino digital Pin 9, 74HC595 Pin 12)
static inline void shift8_595_row(uint8_t row)
{
// the output of the '595 for the selected row should be high, all others
// low
uint16_t output = (1 << row);
uint16_t nbit = 1 << (NUM_ROWS - 1); //0x80;
for (; nbit; nbit >>= 1) {
if (nbit & output) {
SHIFT_DATA_PORT |= _BV(SHIFT_DATA_PIN);
}
else {
SHIFT_DATA_PORT &= ~_BV(SHIFT_DATA_PIN);
}
// pulse the '595 sclk
SHIFT_CLK_PORT |= _BV(SHIFT_CLK_PIN);
SHIFT_CLK_PORT &= ~_BV(SHIFT_CLK_PIN);
}
}
in setup()
SHIFT_DATA_DDR |= _BV(SHIFT_DATA_PIN);
SHIFT_CLK_DDR |= _BV(SHIFT_CLK_PIN);
in ISR(TIMER1_OVF_vect)
add shift8_595_row(shiftRow); after TlcMux_shiftRow(shiftRow);
Original comment by rafal83
on 5 Jan 2013 at 12:29
Wow that's great rafal83. Thanks for taking the time. I'm ashamed to say I'd
given up on this but will now go back to it and give it another go.
Tom
Original comment by tomschof...@gmail.com
on 6 Jan 2013 at 11:12
Original issue reported on code.google.com by
tomschof...@gmail.com
on 23 Oct 2012 at 4:45