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 Programm ing the Frequenc y
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) reg ister holds a programmed value tha t specifies the output frequen cy.
This value is reloaded into the down-counter each time the counte r reache s 0.
7 0
8XC196MD Output Frequen cy
Bit
Number Function
7:0 Output Frequency
Use the followin g formula to calcu late the FREQ value for the desi red output frequ ency
and write this value to the frequency register.
where:
FREQ = 8-bit value to load into FREQ_GEN register
FXTAL1 = input frequency on XTAL1 pin, in MHz
FREQ_OUT = output frequency on FREQOUT pin, in MHz
Figure 8-2. Frequency (FREQ_GEN) Register
FREQ FXTAL1
16 FREQ_OUT
×
---------------------------------------------
=1