8-3
FREQUENCY GENERATOR
8.2 PROGRAMMING THE FREQUENCY GENERATOR
This section explains how to configure the frequency generator and determine its status.
8.2.1 Configuring the Output
The frequency generator’s output is multiplexed with P7.7, so you must configure it as a special-
function output signal. To do so, follow this sequence:
1. Clear bit 7 of P7_DIR.
2. Set bit 7 of P7_MODE.
3. Clear bit 7 of P7_REG.
Refer to Chapter 6, “I/O Ports,” for additional information about configuring port pins.
8.2.2 Programming the Frequency
Program the frequency register (Figure 8-2) to control the frequency of the output.
FREQ_GEN
(8XC196MD)
Address:
Reset State:
1FB8H
00H
The frequency (FREQ_GEN) register holds a programmed value that specifies the output frequency.
This value is reloaded into the down-counter each time the counter reaches 0.
7 0
8XC196MD
Output Frequency
Bit
Number
Function
7:0 Output Frequency
Use the following formula to calculate the FREQ value for the desired output frequency
and write this value to the frequency register.
where:
FREQ = 8-bit value to load into FREQ_GEN register
F
XTAL1
= input frequency on XTAL1 pin, in MHz
FREQ_OUT = output frequency on FREQOUT pin, in MHz
Figure 8-2. Frequency (FREQ_GEN) Register
FREQ
F
XTAL1
16
FREQ_OUT
×
---------------------------------------------
= 1–