1 / 11

ECE 447: Lecture 8

ECE 447: Lecture 8. Timer System. ECE447: Timer I/O Pins. PA0 - Input Capture 3 (IC3) PA1 - Input Capture 2 (IC2) PA2 - Input Capture 1 (IC1) PA3 - Input Capture 4/ Output compare 5 (IC4/OC5) PA4 - Output Compare 4 (OC4)

sahkyo
Download Presentation

ECE 447: Lecture 8

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. ECE 447: Lecture 8 Timer System

  2. ECE447: Timer I/O Pins PA0 - Input Capture 3 (IC3) PA1 - Input Capture 2 (IC2) PA2 - Input Capture 1 (IC1) PA3 - Input Capture 4/ Output compare 5 (IC4/OC5) PA4 - Output Compare 4 (OC4) PA5 - Output Compare 3 (OC3) PA6 - Output Compare 2 (OC2) PA7 - Pulse Accumulator Input (PAI)

  3. Example for Input Capture 1 Unusual procedure!!! Set a flag Clear a flag #define IC1F 0x04 Cannot be done in software!!! TFLG1 = IC1F; Set by a preselected edge at the PA2 input Cleared by writing 1 to the corresponding bit location!!! ECE 447: Setting and Clearing Event Flags

  4. ECE447: Measuring Pulse Widths 100 s < width < 32.768 ms stop start width  100 s stop start width  32.768 ms stop start Timer overflows

  5. ECE 447: Measuring intervals <216 clock cycles FFFF stop start 0

  6. ECE 447: Measuring intervals <216 clock cycles (overflow) 1 2 FFFF start stop 0

  7. ECE 447: Measuring intervals >216 clock cycles 1 2 N=3 FFFF stop R start 0

  8. ECE 447: Measuring intervals >216 clock cycles 3 N=4 1 2 FFFF R1 start R1+R2=R stop 0 R2

  9. ECE447: Class Exercise Output Compare Write a program that generates a square wave with the frequency of 50 Hz and the duty cycle 25% at pin PA6 of MC68HC11. (use polling) Write the same function using interrupts.

  10. ECE447: Class Exercise Delay Function Write a function in C that generates a delay specified as an argument to this function. Assume that the delay is given in the number of clock cycles. (use polling) Write the same function using interrupts.

  11. ECE447: Class Exercise Pulse Accumulator Write a function in C that counts the number of pulses at the input PAI during the period of 30 ms. Write the same function using interrupts.

More Related