| | When the Operate property is 1, the oFreqH Object cycles I/O line 21 at a rate specified by the Rate property. The Rate property is a clock divider value that specifies the frequency. The frequency generated is expressed as a 16-Bit divisor to a fixed frequency of 2.5 MHz. [Frequency = (2,500,000 / (65,535 - Rate))] The valid range for Rate is 1 to 65279. If 0 is given as the divider, then the output is shut off, if the divisor is 65280 or above then the divisor is read as (Rate - 65279). The Rate can be calculated for the desired frequency using the following formula: Rate = 65,535 - (2,500,000 / Frequency) For example: The frequency to product the musical note E5 is 659.26Hz. 65,535 - (2,500,000 / 659.26) = ~61742.87 which would be rounded to 61743 The lowest* frequency that can be generated is 38.1481Hz [38.1481 = (2,500,000/65,535-1)] The highest frequency that can be generated is 9,765.625Hz [9,765.625 = (2,500,000/65,535-65279)] The oFreqH Object generates and outputs only one frequency. Note that two oFreqH Objects will not produce two independent frequencies. if you need two or more independent frequencies or need music capabilities, see the oSoundgin object. The Timer property is an instance of the oTimer object which the oFreqH Object uses to maintain the timing for the output. The oFreqH Object configures Timer's properties so that it will count at a 2.5 MHz rate using a 16-Bit value. Since all instances of the oTimer Object use the same PIC hardware then all instances of the oFreqH Objects will use the same 16-Bit value. (see oTimer Object for more detail) Also note that all other objects that use the oTimer object will also use the same 16-Bit value as well. For instance, The oCounter2h Object uses an instance of the oTimer object. *It should be noted that the Timer property (which is an oTimer Object) has a prescale property that allows the 2.5 MHz clock to be divided thereby allowing for lower frequencies to be produced. For example, setting the PreScale to 3 with the following code, X.Timer.PreScale = 3, will cause the timer's input clock to be divided by 8 and thus a Rate of 1 will produce a frequency of 4.77Hz. |
| The following table lists the properties of the oFreqH Object:
|