Skip to content
This repository was archived by the owner on Mar 29, 2021. It is now read-only.

Commit 5e294b5

Browse files
committed
PCMSK2 wasn't set correctly
1 parent 9e3a4c4 commit 5e294b5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

main.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,15 @@ int main(void) {
8282
}
8383

8484
void init(void) {
85+
PORTB = 0x3C; // enable pull-ups on unused pins
86+
PORTC = 0xC0;
87+
PORTD = 0xE0;
8588
DDRB = 0xC3; // enable LEDs
8689
DDRC = 0x3F; // initialize switch control pins as outputs
87-
PORTC = 0x0;
8890
DDRD = 0x0; // set PD to input
89-
PORTD = 0x0; // disable pull-ups
9091
PRR = 0xE7; // power reduction
9192

92-
PCMSK2 = 0x3F; // prepare interrupts for every input pin
93+
PCMSK2 = 0x1F; // prepare interrupts for every input pin
9394
PCICR = 0x4; // enable PCINT for PORTD
9495
TCCR1B |= (1 << WGM12); // setting up Timer/Counter1 to cause Compare Match A interrupt every second
9596
TIMSK1 |= (1 << OCIE1A);

0 commit comments

Comments
 (0)