Beispiel #1
0
void 
shift_write(uint8_t data)
{
        uint8_t i;
        for (i = 0; i < 8; i++) {
                if (data & 0b10000000) {
                        PORTB |=   (1 << PB0);
                } else {
                        PORTB &= (~(1 << PB0));
                }
                shift_pulse();
                data = data << 1;
        }
        shift_latch();
}
Beispiel #2
0
int main(void) {
    // Initalize the shift/latch interface.
    shift_latch_init(config);

    for (;;) {
        // Shift out the binary from 0 to 255 each 100ms.
        for (byte i = 0; i < 256; i++) {
            byte buff[2] = { i, 255-i };
            shift_latch(config, buff, 2);
            delay_ms(100);
        }
    }

    return 0;
}