I've been trying to interface a SN74HC594 chip to an AVR 2313 (using avr-gcc) and having a tough time with it.
I have the following function, but it appears as if only the MSB get's set every time it's called.
void write7SegChar(char displayValue) {
// Turn bit on PORTX |= BIT(x) // Turn bit off PORTX &= ~BIT(x) // Toggle bit PORTX ^= ~BIT(x) // // Load PB0 with serial value (MSB First) // Pulse SCLK (PB1) with each value // Pulse RCLK (PB2) after all eight bits are gone // // PB3 is RCLR // PB4 is SCLR
PORTB &= ~(_BV(PB3) | _BV(PB4)); // bring RCLR & SCLR LOW for clear PORTB |= (_BV(PB3) | _BV(PB4)); // bring high again
for (int i = 0; i < sizeof(char); i++) { if((displayValue