|
Seminar #7 Interrupt & External - Interrupt
15th, J.H Won
|
|
|
|
Contents
What is Interrupt? External Interrupt? - Resister Setting How to Code?
|
|
|
|
What is Interrupt?
Execute Main Function Interrupt Request Save Return Adress Execute Interrupt Function Return Main Func Load Return Adress
|
|
|
|
External Interrupt?
External : 외부의 INTn Pin에 대한 입력으로인한 이벤트 발생 Rising Edge, Falling Edge, Low Level 논리값에 의한 변환
|
|
|
|
Resister Setting
MCUCR – MCU Control Resister Bit 3 ~ 0 : Interrupt Sense Control Resister
|
|
|
|
External Interrupt?
MCUCSR – MCU Control and Status Resister Bit 6 : Interrupt Sense Control Resister 2
|
|
|
|
External Interrupt?
GICR – General Interrupt Control Resister Bit 7 ~ 5 : External Interrupt Enable 0 ~ 2
|
|
|
|
External Interrupt?
GIFR – General Interrupt Flag Resister Bit 7 ~ 5 : External Interrupt Flag 0 ~ 2
|
|
|
|
How To Code ?
#include Int main(void) { DDRD = 0x00; // Data direction : Input DDRA = 0xff; // Data direction : output : LED MCUCR = 0x03; // Sense Control Resister 0, 1 : INT0 Falling Edge MCUCSR = 0x00; // Sense Control Resister 2 : None GICR = 0x40; // Interrupt Control : INT0 Enable GIFR = 0x00; // Flag Resister : None __SEI(); // = Enable_Interrupt();; for(;;) { } } #pragma vector=INT0_vect // Interrupt Function __interrupt void INT0_interrupt(void) { PORTA = 0xff; // QnA }
|
|
|
|
|
|
|
|
|
|
Copy the following code to your webpage or blog to embed this presentation:
<a href="http://www.slidefinder.net/p/preview_how_this_work/33003494" class="slidefinder">1194037281</a>
<script type="text/javascript" src="http://www.slidefinder.net/scripts/embedded.js"></script>
<a href="http://www.slidefinder.net/p/preview_how_this_work/33003494" class="slidefinder">1194037281</a>
Det3
<script type="text/javascript" src="http://www.slidefinder.net/scripts/embedded.js"></script>
Share this presentation:
Comments