Has anybody looked at the FreqOut function on an oscilloscope? At least in my case it doesn't generate a sine wave as documented. -Michael |
FreqOut function not a sine wave
Started by ●February 18, 2005
Reply by ●February 18, 20052005-02-18
--- In , "Michael Krause" <pistorum@y...> wrote: > Has anybody looked at the FreqOut function on an oscilloscope? At > least in my case it doesn't generate a sine wave as documented. Surely you realize that it is a digital approximation to a sine wave that requires filtering. You're not going to get a waveform straight out of the pin that looks like it's from a signal generator. I am able to produce a fairly decent looking 880Hz sine wave using a low pass filter with R=1K, C=0.1uF. At the pin, though, it is not recognizable as a sine wave. Also, to do much with the signal you're going to have to feed it to an amplifier circuit that has the ability to drive whatever you're interested in driving. Don |
Reply by ●February 19, 20052005-02-19
--- In , "Don Kinzer" <dkinzer@e...> wrote: > [FreqOut produces] a digital approximation to a sine wave > that requires filtering. I believe that the BX-24 uses the same pseudo-PWM method to implement FreqOut (and PlaySound) as it uses for PutDac and DACPin. The basic idea behind this method is to repeatedly add a value (representing the desired output value) to an accumulator. For each addition, if a carry out results the output is set to logic high, otherwise it is set to logic low. Over a long period of time (compared to the addition cycle), the average amount of time that the output is high is directly proportional to original desired value. If you were to look at this output on an oscilloscope, you'd see a stream of pulses with what appear to be random on and off times. If you were to average the output voltage over time, you would see then see the desired waveform. The resistor/capacitor combination of a low pass filter effectively performs the averaging function. Below is link to an article by Tracy Allen describing the pseudo-PWM method. Although it describes the process on the Basic Stamp, the core ideas are the same. Also, The article gives some guidelines for output buffering circuits that should also work for the BX-24. http://www.emesystems.com/BS2PWM.htm |