NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Interupts with a button

July 15, 2011
by jasongillikin
jasongillikin's Avatar

Just curious what the correct code is for using the interupt pins with a button... what Do I call the Pin???

is it PIND |=(1<<PD3);

OR is it PORTD |= (1<<PCINT19);

OR Both, or Either... None maybe?

Thanks for the help


July 16, 2011
by BobaMosfet
BobaMosfet's Avatar

Download the ATMEGA168 Data sheet (you can search on google), and it will explain how you address pins.


July 16, 2011
by Noter
Noter's Avatar

Write to PORTD and read from PIND. Either PD3 or PCINT19 is fine because they are both defined iom168p.h with a value of 3.

Post a Reply

Please log in to post a reply.

Did you know that two resistors plus a transistor can be used to make a better voltage supply? Learn more...