Hardware configuratie

PRG LED (programmer-ready) - PC0 (Actief hoog)

Busy LED - PD5 (Actief hoog)

Slow jumper - PC1 (Actief laag, met interne pullup weerstand)
#define F_CPU 12000000
#include "s/g.h"
#include <util/delay.h>
int main(void){
// Init HW
// Both LEDs on
// Activate pull-up resistor for PC1 (slow-jumper)
sbi(PORTC, 0);
sbi(DDRC, 0);
sbi(PORTD, 5);
sbi(DDRD, 5);
sbi(PORTC, 1);
cbi(DDRC, 1);
// both LEDs on for 1s
_delay_ms(1000);
while(1){
// PRG-ready LED (C0) on for 400ms
// Busy LED (D5) off
cbi(PORTD, 5);
sbi(PORTC, 0);
_delay_ms(400);
// Only when the slow-jumper is shorted, the busy-LED will blink
if(!(PINC&(1<<1))){
sbi(PORTD, 5);
}
// PRG-led always during this part off the cycle
cbi(PORTC, 0);
_delay_ms(400);
}
return 0;
}