Output Captur - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Output Captur

Description:

Output Capture – PowerPoint PPT presentation

Number of Views:49
Avg rating:3.0/5.0
Slides: 10
Provided by: csupo
Category:
Tags: captur | hi | output

less

Transcript and Presenter's Notes

Title: Output Captur


1
Output Capture
2
Output Capture Function
  • inform the 68HC11 to conduct a specific action
    when a specific time is arrived
  • similar to an alarm clock - When the real-time of
    the clock is equal to the preset alarm time, the
    alarm is activated
  • Five output compare channels are provided OC1,
    OC2, OC3, OC4 and OC5.
  • Each function is implemented with three
    functional hardware blocks an output-compare
    register, a dedicated 16-bit comparator and
    interrupt generation logic

3
(No Transcript)
4
Output Compare Registers
5
Timer Control Register TCTL1
6
Timer Interrupt Mask Register 1 (TMSK1)
Timer Interrupt Flag Register 1 (TFLG1)
7
Example
  • include lthc11.hgt
  • main ( )
  • PORTA 0x40 / set OC2 pint to high /
  • TCTL1 0x40 / select toggle as the OC2 pin
    action /
  • TOC2 TCNT 800/ start an OC2 operation with
    800 E cycles /
  • TFLG1 0x40 / clear OC2F flag /
  • while (1)
  • while (!(TFLG1 0x40)) / wait for 400 ms /
  • TFLG1 0x40
  • TOC2 1200 / start next OC2 operation with
    1200 E cycles / while (!(TFLG1 0x40))
  • TFLG1 0x40
  • TOC2 800
  • return 0

8
OC1 - Control up to 5 Multiple Output-Compare
Functions
OC1M (100C)
OC1D (100D)
9
What does this program do?
main () unsigned int oc1_cnt PACTL
0x80 / configure PA7 for output / OC1M
0xF8 / allow OC1 to control OC1-OC5 pins
/ TFLG1 0x80 / clear OC1F flag / TOC1
TCNT 20000 / start an OC1 operation with 10
ms delay / while (1) OC1D 0xA8 /
prepare to set PA7, PA5, and PA3 to high
/ oc1_cnt 500 / number of OC1 operations
to create 5 s delay / while (oc1_cnt)
while (!(TFLG1 0x80)) TFLG1 0x80 /
clear OC1F flag / TOC1 20000 / start the
next OC1 operation / oc1_cnt -- OC1D
0x50 / value to pull PA6 and PA4 to high
/ oc1_cnt 500 while (oc1_cnt) while
(!(TFLG1 0x80)) TFLG1 0x80 / clear OC1F
flag / TOC1 20000 / start the next OC1
operation / oc1_cnt --
Write a Comment
User Comments (0)
About PowerShow.com