Shop OBEX P1 Docs P2 Docs Learn Events
frequency to pulse width for BS2 — Parallax Forums

frequency to pulse width for BS2

ArchiverArchiver Posts: 46,084
edited 2002-02-06 03:13 in General Discussion
What is the best way to get pulse width in microseconds from frequency in Hz
for use with the Stamp? I know that the period is the reciprocal of the
frequency and the pulse width would then be half of the period (assume equal
low and high periods). But since the stamp doesn't do fractions I'm not sure
the best way to get the pulse width from a frequency value. Thanks!

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-02-05 01:49
    There are several ways to do this described at this URL:
    http://www.emesys.com/BS2math2.htm#Reciprocal
    Depends on the range of pulse widths you have and the accuracy you require.

    -- Tracy



    >What is the best way to get pulse width in microseconds from frequency in Hz
    >for use with the Stamp? I know that the period is the reciprocal of the
    >frequency and the pulse width would then be half of the period (assume equal
    >low and high periods). But since the stamp doesn't do fractions I'm not sure
    >the best way to get the pulse width from a frequency value. Thanks!
  • ArchiverArchiver Posts: 46,084
    edited 2002-02-05 04:59
    Thanks! But the link you provided isn't responding. I will try it again
    later.
    Can someone explain the freqout command for the BS2. Since the max value is
    32Khz can I put in the max value for both frequencies to get 64Khz (sum and
    difference frequencies) since the output is a mixture of the two programmed
    frequencies? Why the 32Khz limit?
  • ArchiverArchiver Posts: 46,084
    edited 2002-02-05 06:58
    >Thanks! But the link you provided isn't responding. I will try it again
    >later.

    Please do try it again. Sometimes the packets get lost in cyberspace.
    <http://www.emesystems.com/BS2math2.htm#Reciprocal>

    >Can someone explain the freqout command for the BS2. Since the max value is
    >32Khz can I put in the max value for both frequencies to get 64Khz (sum and
    >difference frequencies) since the output is a mixture of the two programmed
    >frequencies? Why the 32Khz limit?

    The freqout command is created by using PWM, and the base time slot
    for the PWM is about 4.5 microseconds. The superposition rule does
    not really apply for addition of frequencies. Although it does work
    well for subtraction. For example, freqout 0,5000,1000,1001 gives a
    nice 1 hz beat frequency.

    There is some more information about Stamp PWM you might find of
    interest at this URL:

    http://www.emesystems.com/BS2PWM.htm

    If you just need several discrete square-wave frequencies, and you
    aren't particular about exactly what they are, you can get them
    directly of the PWM command.

    There are some external frequency synth chips, but I don't have URLs at hand.

    -- regards,
    Tracy Allen
    electronically monitored ecosystems
    mailto:tracy@e...
    http://www.emesystems.com
  • ArchiverArchiver Posts: 46,084
    edited 2002-02-06 03:13
    Thanks for the info. I did finally get the link to respond. Great stuff!!
    I need every frequency from 1 Hz to 100 kHz in 1 Hz increments! I had tried
    to use the PAK8 but now thinking about just the Stamp and maybe a multiplier
    to get the even frequencies above 32K. Although I'm not sure how that will
    work with the PWM signal from the stamp.
Sign In or Register to comment.