Shop OBEX P1 Docs P2 Docs Learn Events
Continuous FREQOUT — Parallax Forums

Continuous FREQOUT

buckey29buckey29 Posts: 6
edited 2005-11-21 01:42 in BASIC Stamp
I'm using the freqout command to output two frequencies - example 1000hz and 1001hz. The sin waves start in phase, go out of phase and back into phase. I am trying to figure how to calcuate a proper time to play the freqout so that it starts and stops in phase. Does that make sense?

freqout 1, 1000, 1001, <what value here>

And how could I calculate that for various pairs of frequencies that I may use? And if there is a formula (I'm sure there is) can I just double the time to play two complete phases?

Thanks in advance for any help.

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-17 05:33
    Hello,

    ·· You could try a larger duration.· Also, are you using the recommended filter circuit for connecting to your audio device (Or do you have a PDB)?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • buckey29buckey29 Posts: 6
    edited 2005-11-18 03:54
    Even the longest duration isn't long enough....but I am not doing as you suggest. I don't have the filter circuit noted in the book.

    So, is there no way to calculate this that you are aware of?
  • Beau SchwabeBeau Schwabe Posts: 6,557
    edited 2005-11-18 04:46
    With your example of 1000Hz and 1001Hz, you essentially have a BFO (Beat Frequency Oscillator).
    The BFO has a frequency of 1Hz, so I would think that the pause duration would be 1000mS or 1 second
    or a multiple of that.

    For 1000Hz and 1002Hz ---> 500mS
    1000Hz and 1005Hz ---> 200mS

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-11-19 19:13
    As Beau pointed out, the beat frequency is the difference between the two frequencies. You sytax was a little wrong.

    beatduration = 1000 ' milliseconds
    freqout 1, beatperiod, 1000, 1001

    would give a 1 second single cycle of the 1 hertz beat frequeny. (That is for the BS2 and BS2e only. The faster stamps have different parameters--See the manual) The beat frequency is
    f2 - f1
    and the one cycle beat duration is
    1 / (f2 - f1) in seconds
    On the BS2 stamp use,
    beatduration = 1000 / (f2 - f1)

    The slowest beat you can get on a Stamp is one second. What are you trying to do??

    If you attach an LED you get a nice pulsing effect, or for audio a soft attack or bell like effect if you let it go for 1/2 or 1 period.



    buckey29 said...
    I'm using the freqout command to output two frequencies - example 1000hz and 1001hz. The sin waves start in phase, go out of phase and back into phase. I am trying to figure how to calcuate a proper time to play the freqout so that it starts and stops in phase. Does that make sense?

    freqout 1, 1000, 1001, <what value here>

    And how could I calculate that for various pairs of frequencies that I may use? And if there is a formula (I'm sure there is) can I just double the time to play two complete phases?

    Thanks in advance for any help.
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • buckey29buckey29 Posts: 6
    edited 2005-11-21 01:42
    Thank you for the replies! Its for audio...so when I stopped off of the beat frequency I got odd sounds. I'll try this!
Sign In or Register to comment.