
























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
its for cmp3006 and 3010 some of the university notes it will be help
Typology: Lecture notes
1 / 32
This page cannot be seen from the preview
Don't miss anything!
Atmega 328 Pinout
Interrupts
UART ready with/for next character
Signal change on pin
๏ Action depends on context
Power failure
Arithmetic exception
Timer โtickโ
ATmega328 Interrupts
RESET has the highest priority, and next is INT0 โ the External Interrupt Request 0.
ATmega328 Interrupts
ATmega328 Interrupts
Interrupts
If interrupt is not enabled, flag is set
๏ When interrupt is enabled again, interrupt takes place, and flag is reset
Signal level causes interrupt
If level occurs when interrupt is enabled, interrupt takes place
If interrupt is not enabled, and level goes away before the interrupt is enabled, nothing
happens
Interrupt Vectors
Interrupt Vector
Interrupts
Bit in SREG
Allows all interrupts to be disabled with one bit
sei() โ set the bit
cli() โ clear the bit
Lower addresses have higher priority
automatically generated for ISR
External Interrupts
๏ INT0 and INT1 โ range of event options
๏ INT0 โ PORTD [2]
๏ INT1 โ PORTD [3]
๏ PCINT[7:0] โ PORT B [7:0]
๏ PCINT[14:8] โ PORT C [6:0]
๏ PCINT[23:16] โ PORT D [7:0]
INT0 and INT
If INT# bit is set (and the SREG I-bit is set), then interrupts are enabled on pin INT#
Interrupt flag bit is set when a change triggers an interrupt request
Flag is cleared automatically when interrupt routine is executed
Flag can be cleared by writing a 1 to it
Arduino Platform Support for
External Interrupts
interrupt: 0 or 1
function : interrupt function to call
mode: LOW, CHANGE, RISING, FALLING