Hardware Reference
In-Depth Information
The circuit connection for the period measurement is shown in Figure 8.15, and the logic flow
for the period measurement is shown in Figure 8.16.
68HC12
PT0
1 period
Figure 8.15 Period measurement signal connection
Start
Choose to capture the rising edge
Set the timer counter prescale factor to 64
Enable the timer counter
Clear the C0F flag
No
C0F = 1?
Ye s
Save the captured first edge
Clear the C0F flag
No
C0F = 1?
Ye s
Take the difference of the second and
the first captured edges
Stop
Figure 8.16 Logic flow of period measurement
The assembly program that measures the period using this method is as follows:
#include
“c:\miniide\hcs12.inc”
org
$1000
edge_1st
rmb
2
; memory to hold the first edge
period
rmb
2
; memory to store the period
Search WWH ::




Custom Search