1 / 14

Seminar #7 Interrupt & External - Interrupt

Seminar #7 Interrupt & External - Interrupt. 15 th , J.H Won. Preview – H ow this work?. Contents. W hat is Interrupt? E x ternal Interrupt? - R esister Setting How t o Code?. What is Interrupt?. What is Interrupt?. Execute Main Function. Interrupt Request.

thea
Télécharger la présentation

Seminar #7 Interrupt & External - Interrupt

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Seminar #7 Interrupt & External - Interrupt 15th, J.H Won

  2. Preview – How this work?

  3. Contents • What is Interrupt? • External Interrupt? • - Resister Setting • How to Code?

  4. What is Interrupt?

  5. What is Interrupt? Execute Main Function Interrupt Request Save Return Adress Return Main Func Load Return Adress Execute Interrupt Function

  6. External Interrupt? • External : 외부의 • INTn Pin에 대한 입력으로인한 이벤트 발생 • Rising Edge, Falling Edge, Low Level • 논리값에 의한 변환

  7. External Interrupt?

  8. Resister Setting MCUCR – MCU Control Resister Bit 3 ~ 0 : Interrupt Sense Control Resister

  9. External Interrupt? MCUCSR – MCU Control and Status Resister Bit 6 : Interrupt Sense Control Resister 2

  10. External Interrupt? GICR – General Interrupt Control Resister Bit 7 ~ 5 : External Interrupt Enable 0 ~ 2

  11. External Interrupt? GIFR – General Interrupt Flag Resister Bit 7 ~ 5 : External Interrupt Flag 0 ~ 2

  12. How To Code ? #include<iom8535.h> 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 }

  13. Repeat

  14. Any Question?

More Related