2.9.1.7 - Frequency Output (Mode 7) [U6 Datasheet]
Outputs a square wave at a frequency determined by the following formula:
frequency = TimerClockBase/(TimerClockDivisor*2*Timer#Value)
The Value passed should be between 0-255, where 0 is a divisor of 256. By changing the clock configuration and timer value, a wide range of frequencies can be output, as shown in the following table:
Table 2.9.1.7-1. Mode 7 Frequency Ranges
TimerClockBase |
| Divisor=1 Value =1 | Divisor=1 Value = 256 |
---|---|---|---|
0 | 4 MHz | 2000000 | 7812.5 |
1 | 12 MHz | 6000000 | 23437.5 |
2 | 48 MHz (Default) | 24000000 | 93750 |
3 | 1 MHz /Divisor | 500000 | 7.629 |
4 | 4 MHz /Divisor | 2000000 | 30.518 |
5 | 12 MHz /Divisor | 6000000 | 91.553 |
6 | 48 MHz /Divisor | 24000000 | 366.211 |
The frequency output has a -3 dB frequency of about 10 MHz on the FIO lines. Accordingly, at high frequencies the output waveform will get less square and the amplitude will decrease.
The output does not necessarily start instantly, but rather has to wait for the internal clock to roll. For the Frequency Output mode, the start delay varies from 0.0 to TimerClockDivisor*256/TimerClockBase
. For example, if TimerClockBase = 48 MHz and TimerClockDivisor = 256, the start delay will vary from 0 to 1.4 ms.