28.03.2015 Views

68HC11 Timing System

68HC11 Timing System

68HC11 Timing System

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Example 4.<br />

Determining the Period of a Square Wave.<br />

• The following program determines the period of a square wave<br />

by finding the time between rising edges.<br />

• The TCTL at $1021 is set up to detect rising edges on PA0.<br />

• Then the program jumps to SUB2, which clears the input capture<br />

flag IC3F, and waits until it is set again.<br />

• The time of its setting is stored in TIC3, at $1014 and $1015. This<br />

time is saved in memory (at location FIRST) and SUB2 is executed<br />

again to get the time of the next positive edge.<br />

• The difference between the times is a measure of pulse width.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!