/* * Digital I/O (dual 7-segment LED) lab program. * * This program demonstrates the use of a (dual) 7-segment LED display. * Initially it displays just one number, but provides a template for making * it count up from 00 to 99, pausing 0.1 second between numbers. * * When using an LED decoder chip like the 7447, only four data pins are * needed to represent the values 0-9 on one display digit, as opposed to one * pin for each digit (so, 7 total). Because there are two digits and each * requires four bits, all eight pins can share one port, and we're using PORTB * for this in the template below. * * Last Modified 2010/09/29 15:25 (ebw) */ #include // for PORTx, DDRx, etc. #include // for _delay_ms() void init(void) { DDRB = 0xFF; // all eight bits are outputs } /* * Count from 00 to 99, delaying 0.1sec in between. */ int main(void) { init(); // call init to set up PORTB pins PORTB = 0x55; // drive test value onto display while (1) { /****** uint8_t counter; for ( counter ... FIXME ) { // FIXME: do something here with counter to generate inputs // to decoders on PORTB PORTB = FIXME... _delay_ms(100); } *******/ } return 0; // never executed... }