lecture_note8

lecture_note8 - CpE 390: Microprocessor Systems Lecture 8...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Stevens Institute of Technology 1 CpE 390: Microprocessor Systems Lecture 8 68HC12 Timer Functions
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Stevens Institute of Technology 2 Why are Timer Functions Important? - Time delay creation and measurement - Period and pulse width measurement - Frequency measurement - Event counting - Arrival time comparison - Time-of-day tracking - Periodic interrupt generation - Waveform generation
Background image of page 2
Stevens Institute of Technology 3 A Summary of the 68HC12 Timer Functions Main timer 16-bit timer Can be started and stopped any time Input capture function Up to 8 channels -- 0 to 7 Each channel has a 16-bit latch, edge-detection logic, flag bit, and interrupt logic Will load the current main timer value into the input capture register when the selected signal edge is detected Can be used to measure the signal frequency, period, and pulse width and as time reference
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Stevens Institute of Technology 4 A Summary of the 68HC12 Timer Functions 3. Output compare functions - Eight channels (OC1…OC5) - Each channel has a 16-bit comparator, 16-bit register, action pin, interrupt request circuit, and forced-compare function - Continuously compares the value of the 16-bit compare register with that of the main timer and may optionally - trigger an action on a pin - generate an interrupt - sets a flag in a register. - Is often used to create a time delay and generate a waveform 4.Real-time interrupt - Generates periodic interrupts when enabled - Interrupt period is programmable
Background image of page 4
Stevens Institute of Technology 5 A Summary of the 68HC12 Timer Functions 5. Pulse accumulator - Has an 16-bit counter - Can be used to measure events, frequency of unknown signal, or the duration of a pulse width 6. Pulse Width Modulation (PWM) - Can generate periodic waveforms without the intervention of CPU after the duty cycle and frequency have been set up. - All except the 812A4 have 4 channels of PWM function.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Stevens Institute of Technology 6 Timer Counter Register (TCNT) -Required for input capture and output compare functions. -Must be read in one 16-bit operation in order to obtain the correct value. -Three other registers are related to the operation of the TCNT: TSCR, TMSK2, TFLG2. Timer System Control Register (TSCR) -The contents of TSCR are shown in Figure 8.1. - Setting and clearing the bit 7 of TSCR will start and stop the counting of the TCNT. - Setting the bit 4 will enable fast timer flag clear function, which means a read from input-capture register or a write to an output-compare register will clear the flag. If this bit is clear, then the user must write a one to a timer flag in order to clear it.
Background image of page 6
Stevens Institute of Technology 7 7 65 4 3210 T E N T S W A I T S B C K T F F C A 0000 value after reset 00000000 read: anytime write: anytime TEN -- timer enable bit 0 = disable timer; this can be used to save power consumption 1 = allows timer to function normally TSWAI -- timer stops while in wait mode bit 0 = allows timer to continue running during wait mode 1 = disables timer when MCU is in wait mode TSBCK -- timer stops while in background mode bit
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 55

lecture_note8 - CpE 390: Microprocessor Systems Lecture 8...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online