Presentation is loading. Please wait.

Presentation is loading. Please wait.

#1 of 10 Tutorial Introduction PURPOSE -To explain how to configure and use the Timer Interface Module in common applications OBJECTIVES: -Identify the.

Similar presentations


Presentation on theme: "#1 of 10 Tutorial Introduction PURPOSE -To explain how to configure and use the Timer Interface Module in common applications OBJECTIVES: -Identify the."— Presentation transcript:

1 #1 of 10 Tutorial Introduction PURPOSE -To explain how to configure and use the Timer Interface Module in common applications OBJECTIVES: -Identify the steps to set up and implement an output compare function. -Identify the steps to set up and implement an input capture function. -Identify the steps to set up and implement both unbuffered and buffered pulse width modulation functions. -Identify the differences between unbuffered and buffered PWMs. CONTENTS: -20 pages -6 questions LEARNING TIME: -45 minutes PREREQUISITE: -68HC08 CPU Training Module

2 #2 of 10 Timer Interface Module Block Diagram 16-bit Comparator TCH0 16-bit Latch ELS0B MS0A CH0F ELS0A TOV0 CH0MAX CH0IE Port Logic Interrupt Logic MS0B 16-bit Comparator TCH1 16-bit Latch ELS1B MS1A CH1F ELS1A TOV1 CH1MAX CH1IE Port Logic Interrupt Logic TOF TOIE Interrupt Logic 16-bit Comparator TMOD 16-bit Counter Internal Bus PS2PS1PS0 PrescalerTSTOP TRST Internal Bus Clock TnCH0 TnCH1 Timer Reference Timer Channel 0 Timer Channel 1 CH0IE Interrupt Logic CH1IE Interrupt Logic TOIE Interrupt Logic TOF 16-bit Comparator TMOD 16-bit Counter PS2PS1PS0 PrescalerTSTOP TRST Internal Bus Clock 16-bit Comparator TCH0 16-bit Latch ELS0B MS0A CH0F ELS0A TOV0 CH0MAX CH0IE Port Logic Interrupt Logic MS0B TnCH0 MS0B 16-bit Comparator TCH1 16-bit Latch ELS1B MS1A CH1F ELS1A TOV1 CH1MAX CH1IE Port Logic Interrupt Logic TnCH1

3 #3 of 10 Timer Interface Module Time Reference TOF TOIE Interrupt Logic 16-bit Comparator TMOD 16-bit Counter TSTOP TRST Internal Bus Clock PS2PS1PS0 Prescaler 16-bit Counter TSTOP TRST PS2PS1PS0 Prescaler TOF TOIE Interrupt Logic 16-bit Comparator TMOD

4 #4 of 10 Timer Interface Module Time Reference TOF TOIE Interrupt Logic 16-bit Comparator TMOD 16-bit Counter TSTOP TRST Internal Bus Clock PS2PS1PS0 Prescaler 16-bit Counter TSTOP TRST PS2PS1PS0 Prescaler TOF TOIE Interrupt Logic 16-bit Comparator TMOD

5 #5 of 10 Timer Interface Module Output Compare Overview 16-BIT FREE RUNNING COUNTER 16-BIT OUTPUT COMPARE LATCH PIN CONTROL LOGIC OCx Interrupt Enable Request Interrupt Status Flag 16-BIT COMPARE = ? 16-BIT COUNTER 16-BIT COMPARE Clear (05 & 08) Set (05 & 08) Toggle (08 Only)

6 #6 of 10 Timer Interface Module Output Compare Overview 16-BIT FREE RUNNING COUNTER 16-BIT OUTPUT COMPARE LATCH PIN CONTROL LOGIC OCx Interrupt Enable Request Interrupt Status Flag 16-BIT COMPARE = ? 16-BIT COUNTER 16-BIT COMPARE Clear (05 & 08) Set (05 & 08) Toggle (08 Only)

7 #7 of 10 Timer Interface Module Output Compare Applications Perform a simple timed event Perform a periodic interrupt event Implement a single pulse with variable width Generate a pulse width modulated signal

8 #8 of 10 Timer Interface Module Output Compare Function 16-bit Comparator TCH0 16-bit Latch ELS0B MS0A ELS0A TOV0 CH0MAX CH0IE Interrupt Logic MS0B 16-bit Comparator TCH1 16-bit Latch ELS1B MS1A CH1F ELS1A TOV1 CH1MAX CH1IE Port Logic Interrupt Logic TOF TOIE Interrupt Logic 16-bit Comparator TMOD 16-bit Counter Internal Bus PS2PS1PS0 PrescalerTSTOP TRST Internal Bus Clock TnCH0 TnCH1 1 0 0:0General Purpose I/O 0:1Toggle Output on Compare 1:0Clear Output on Compare 1:1Set Output on Compare TCH0 16-bit Counter ELS0BELS0A CH0F TnCH0 Port Logic

9 #9 of 10 Timer Interface Module Input Capture Overview 16-BIT FREE-RUNNING COUNTER 16-BIT INPUT CAPTURE LATCH EDGE SELECT & DETECT ICx Latch Request Interrupt Rising Edges (05 & 08) Falling Edges (05 & 08) Any Edge (08 Only) Status Flag Interrupt Enable

10 #10 of 10 Timer Interface Module Input Capture Applications Perform time reference to an external event Measure an input period Measure the width of an input pulse Provide additional external interrupts

11 #11 of 10 Timer Interface Module Input Capture Function 16-bit Comparator TCH0 16-bit Latch ELS0B MS0A ELS0A TOV0 CH0MAX CH0IE Port Logic Interrupt Logic MS0B 16-bit Comparator TCH1 16-bit Latch ELS1B MS1A ELS1A TOV1 CH1MAX CH1IE Interrupt Logic TOF TOIE Interrupt Logic 16-bit Comparator TMOD 16-bit Counter Internal Bus PS2PS1PS0 PrescalerTSTOP TRST Internal Bus Clock TnCH0 TnCH1 0 0:0General Purpose I/O 0:1Capture on Rising Edge 1:0Capture on Falling Edge 1:1Capture on Either Edge TCH1 16-bit Counter ELS1BELS1A CH0F TnCH1 CH1F Port Logic 0

12 #12 of 10 Timer Interface Module PulseWidth Modulation Overview Period Duty Cycle 25% Duty Cycle PWM Period Duty Cycle 50% Duty Cycle PWM

13 #13 of 10 Timer Interface Module Unbuffered Pulse Width Modulation 16-bit Comparator TCH0 16-bit Latch ELS0B MS0A ELS0A TOV0 CH0MAX CH0IE Interrupt Logic MS0B 16-bit Comparator TCH1 16-bit Latch ELS1B MS1A CH1F ELS1A TOV1 CH1MAX CH1IE Port Logic Interrupt Logic TOF TOIE Interrupt Logic 16-bit Comparator TMOD 16-bit Counter Internal Bus PS2PS1PS0 PrescalerTSTOP TRST Internal Bus Clock TnCH0 TnCH1 1 0 0:0General Purpose I/O 0:1Toggle Output on Compare 1:0Clear Output on Compare 1:1Set Output on Compare TCH0 16-bit Counter ELS0BELS0A CH0F TnCH0 TCH0 TMOD ELS0BELS0A10 11 Compare TMOD Overflow Port Logic 1 TMOD  TCH0 Duty Cycle = TMOD TCH0 Period Pulse Width Toggle on Overflow 16-bit Comparator

14 #14 of 10 Timer Interface Module Unbuffered Pulse Width Modulation 16-bit Comparator TCH0 16-bit Latch ELS0B MS0A ELS0A TOV0 CH0MAX CH0IE Interrupt Logic MS0B 16-bit Comparator TCH1 16-bit Latch ELS1B MS1A CH1F ELS1A TOV1 CH1MAX CH1IE Port Logic Interrupt Logic TOF TOIE Interrupt Logic 16-bit Comparator TMOD 16-bit Counter Internal Bus PS2PS1PS0 PrescalerTSTOP TRST Internal Bus Clock TnCH0 TnCH1 1 0 0:0General Purpose I/O 0:1Toggle Output on Compare 1:0Clear Output on Compare 1:1Set Output on Compare TCH0 16-bit Counter ELS0BELS0A CH0F TnCH0 TCH0 TMOD ELS0BELS0A10 11 Compare TMOD Overflow Port Logic 1 TMOD  TCH0 Duty Cycle = TMOD TCH0 Period Pulse Width Toggle on Overflow 16-bit Comparator

15 #15 of 10 Timer Interface Module Unbuffered Pulse Width Modulation Overflow Interrupt New TCH Value Period Overflow Interrupt Overflow Interrupt Too Late! Compare Interrupt Compare Interrupt New TCH Value Compare Interrupt New TCH Value Too Late! Compare Interrupt Compare Interrupt New TCH Value Period TCH < TCNT New TCH Value Intermediate TCH Value Compare Interrupt

16 #16 of 10 Timer Interface Module Unbuffered Pulse Width Modulation Overflow Interrupt New TCH Value Period Overflow Interrupt Overflow Interrupt Too Late! Compare Interrupt Compare Interrupt New TCH Value Compare Interrupt New TCH Value Too Late! Compare Interrupt Compare Interrupt New TCH Value Period TCH < TCNT New TCH Value Intermediate TCH Value Compare Interrupt

17 #17 of 10 Timer Interface Module Unbuffered Pulse Width Modulation Overflow Interrupt New TCH Value Period Overflow Interrupt Overflow Interrupt Too Late! Compare Interrupt Compare Interrupt New TCH Value Compare Interrupt New TCH Value Too Late! Compare Interrupt Compare Interrupt New TCH Value Period TCH < TCNT New TCH Value Intermediate TCH Value Compare Interrupt

18 #18 of 10 Timer Interface Module Buffered Pulse Width Modulation 16-bit Comparator TCH0 16-bit Latch ELS0B MS0A ELS0A TOV0 CH0MAX CH0IE Interrupt Logic MS0B 16-bit Comparator TCH1 16-bit Latch ELS1B MS1A ELS1A TOV1 CH1MAX CH1IE Port Logic Interrupt Logic TOF TOIE Interrupt Logic 16-bit Comparator TMOD 16-bit Counter Internal Bus PS2PS1PS0 PrescalerTSTOP TRST Internal Bus Clock TnCH0 TnCH1 X 1 0:0General Purpose I/O 0:1Toggle Output on Compare 1:0Clear Output on Compare 1:1Set Output on Compare TCH0 16-bit Counter CH0F TnCH0 TMOD Port Logic 1 ELS0BELS0A Period TCH1CH1F Toggle on Overflow X XX 16-bit Comparator

19 #19 of 10 Timer Interface Module Buffered Pulse Width Modulation 16-bit Comparator TCH0 16-bit Latch ELS0B MS0A ELS0A TOV0 CH0MAX CH0IE Interrupt Logic MS0B 16-bit Comparator TCH1 16-bit Latch ELS1B MS1A ELS1A TOV1 CH1MAX CH1IE Port Logic Interrupt Logic TOF TOIE Interrupt Logic 16-bit Comparator TMOD 16-bit Counter Internal Bus PS2PS1PS0 PrescalerTSTOP TRST Internal Bus Clock TnCH0 TnCH1 X 1 0:0General Purpose I/O 0:1Toggle Output on Compare 1:0Clear Output on Compare 1:1Set Output on Compare TCH0 16-bit Counter CH0F TnCH0 TMOD Port Logic 1 ELS0BELS0A Period TCH1CH1F Toggle on Overflow X XX 16-bit Comparator

20 #20 of 10 Question What happens when the value in the output compare register is equal to the value in the 16-bit time reference counter? Click on the BEST choice. a) The output compare flag is set. b) An output compare interrupt is generated if enabled. c) The output pin is set, cleared, or toggled if enabled. d) The output pin is toggled if the toggle on overflow option is enabled. e) a, b, and c f) All of the above

21 #21 of 10 Question What is the fastest frequency that can be achieved for a 6-bit PWM when using a 68HC08 with an 8 MHz bus frequency? Click on your choice. a) 500 kHz b) 250 kHz c) 125 kHz d) 62.5 kHz e) 31.25 kHz

22 #22 of 10 Question Does the 16-bit timer reference counter count up or count down? Click on your choice. a) Count up b) Count down c) Programmable up or down

23 #23 of 10 Question What type of input signal event(s) can the timer be programmed to detect before a valid input capture? Click on your choice. a) Rising Edge only b) Falling Edge only c) Rising and/or Falling Edge

24 #24 of 10 Question Is the output compare interrupt option recommended to change the duty cycle in unbuffered PWMs? Click on your choice. a) Yes b) No c) Does not matter

25 #25 of 10 Question Is the counter overflow interrupt option recommended to change the duty cycle in buffered PWMs? Click on your choice. a)Yes b) No c) Does not matter

26 #26 of 10 Tutorial Completion -TIM Configuration -Output Compare -Input Capture -Unbuffered PWM -Buffered PWM


Download ppt "#1 of 10 Tutorial Introduction PURPOSE -To explain how to configure and use the Timer Interface Module in common applications OBJECTIVES: -Identify the."

Similar presentations


Ads by Google