1 / 15

ECT 357

ECT 357. Ch 9 Interrupt’s. Today’s Quote: A person’s true character is revealed by what he does when no one is watching. Obey them not only to win their favor when their eye is on you, but like slaves of Christ, doing the will of God from your heart. Ephesians 6:6. Interrupt Uses.

sharne
Télécharger la présentation

ECT 357

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. ECT 357 Ch 9 Interrupt’s

  2. Today’s Quote: A person’s true character is revealed by what he does when no one is watching. Obey them not only to win their favor when their eye is on you, but like slaves of Christ, doing the will of God from your heart. Ephesians 6:6

  3. Interrupt Uses • Serial Communications • External I/O Access • Completion of Processes • Timers/Counters • Automatic Executions

  4. Interrupt Timing The time it takes to process one interrupt routine must be less than the time between interrupt calls. If there are several interrupts, the total of the interrupts must be less than the time between any of the interrupt calls.

  5. Terms • Latency- The time it takes from when an interrupt is requested until it starts to be processed • Handler- a subroutine which determines what interrupt routine will be processed and in what order. • Critical Region- a portion of code that must be run contiguously that can’t be interrupted by an interrupt.

  6. Interrupt Sources • Timers (0,1,2,3) • Capture/Compare/PWM • Serial Peripheral Interface • I2C Interface • UART • External (0,1,2,RB) • Low Voltage • A/D • Parallel Slave Port

  7. Low Priority Interrupt Initialization • IPEN=0 (Low Interrupts Only) (RCON) • Set Priority Bit (Low) • Set Edge Sensitivity • Set Local Enable Bit • Set Direction Bit (TRISB) • Set Port Bit Type • Clear Flag Bit • GIEL=1 (INTCON) enable low priority ints

  8. Low Priority Interrupt Entry • CPU completes execution of current instruction • GIEL (Global Interrupt Enable) bit is cleared • Contents of the program counter are saved • Program counter loaded with 0x0018

  9. Low Priority Interrupt Handler Execution • Save STATUS Register • Save WREG if used • Test Interrupts For Servicing • Run Interrupt Subroutines • Restore WREG • Restore STATUS register

  10. Low Priority Interrupt Exit • Retfie instruction resets GIEL bit • The saved contents of the program counter are restored • Program counter is loaded with address of next instruction where it left off.

  11. High Priority Interrupt Initialization • IPEN=1 (Low and High Interrupts) (RCON) • Set Priority Bit (High) • Set Edge Sensitivity • Set Local Enable Bit • Set Direction Bit (TRISB) • Set Port Bit Type • Clear Flag Bit • GIEH=1 (INTCON) enable high priority interrupts

  12. High Priority Interrupt Entry • CPU completes execution of current instruction • GIEH (Global Interrupt Enable) bit is cleared • Contents of the program counter, STATUS register, working register, and bank select register are saved • Program counter loaded with 0x0008

  13. High Priority Interrupt Handler Execution • Test Interrupts For Servicing • Run Interrupt Subroutines

  14. High Priority Interrupt Exit • Retfie FAST instruction resets GIEH bit • Contents of the program counter, STATUS register, working register, and bank select register are restored. • Program counter is loaded with address of next instruction where it left off.

  15. External Interrupts • PORTB is used for external interrupts • Set Direction Bit (TRISB) • Set Port Bit Type • B0-2 External Interrupt Pins • B4-7 port change pins (RBIF bit in INTCON)

More Related