Beruflich Dokumente
Kultur Dokumente
Problem: Make LED1 blink, but when a button is pressed light LED2
immediately
Vcc
RA0
RA1 LED1
RA2
PIC RA3
RA4 LED2
int i;
main () {
TRISA = 0b000100; // RA2 is an input, all
// others are outputs
PORTA = 0; // All outputs are 0
while (1 == 1) {
for (i=0; i<25000; i++);
RA0 = RA0 ^ 1;
}
}
Add the following code in the main, before the while loop
Interrupt after 30 us