Hardware Reference
In-Depth Information
8.6.5 Using OC7 to Control Multiple Output-Compare Functions
The output-compare function OC7 is special because it can control up to eight output-com-
pare functions at the same time. The register OC7M specifies the output-compare channels to
be controlled by OC7. The value that any PT x ( x 5 0, . . . , 7) pin can assume when the value of
TC7 equals that of TCNT is specified by the OC7D register. To control an output-compare pin
using OC7, the user sets the corresponding bit in the OC7M register. When a successful OC7
compare is made, each affected pin assumes the value of the corresponding bit of the OC7D reg-
ister. The contents of the OC7M and OC7D registers are shown in Figures 8.22 and 8.23.
7
6
5
4
3
2
1
0
OC7M7 OC7M6 OC7M5 OC7M4 OC7M3 OC7M2 OC7M1 OC7M0
Reset
0
0
0
0
0
0
0
0
OC7M
n
n
= 0,
. . .
, 7
0 = PT
pin is not affected by OC7 function.
1 = a successful OC7 action will override a successful OC6:OC0
compare action during the same cycle and the OC
n
n
action taken
will depend on the corresponding OC7D bit.
Figure 8.22 Output-Compare 7 Mask register (OC7M)
7
6
5
4
3
2
1
0
OC7D7 OC7D6
OC7D5
OC7D4
OC7D3 OC7D2 OC7D1
OC7D0
Reset
0
0
0
0
0
0
0
0
Figure 8.23 Output-Compare 7 Data register (OC7D)
For the OC7 pin, the HCS12 document does not specify what will happen when both the
TCTL1 register and the OC7M:OC7D register pair specify the OC7 pin action on a successful
OC7 compare. Avoid using this combination.
For OC0:OC6, when the OC7M n ( n 5 0, . . . , 6) bit is set, a successful OC7 action will
override a successful OC6:OC0 compare action during the same cycle; therefore, the OC n
action taken will depend on the corresponding OC7D bit. This feature allows a PT n pin to be
controlled by two output-compare functions simultaneously [OC7 and OC n ( n 5 0, . . . , 6)].
Example 8.9
What value should be written into OC7M and OC7D if one wants pins PT2, PT3, and PT4
to assume the values of 1, 0, and 1, respectively, when OC7 compare succeeds?
Solution: Bits 4, 3, and 2 of OC7M must be set to 1, and bits 4, 3, 2 of OC7D should be set to 1,
0, and 1, respectively. The following instruction sequence set up these values:
movb
#$1C,OC7M
movb
#$14,OC7D
 
Search WWH ::




Custom Search