Shop OBEX P1 Docs P2 Docs Learn Events
Higher FREQOUT resolution or PWM resolution — Parallax Forums

Higher FREQOUT resolution or PWM resolution

Andy McLeodAndy McLeod Posts: 40
edited 2007-05-12 00:47 in BASIC Stamp
I recently began working with a project to design and build some acoustic pingers for a free-floating spar buoy. I am using the BS2px to generate 30kHz pulses that run through a power amp and drive a transducer. The customer wants to be able to generate 'chirp' signals of various bandwidths around a center frequency. I intended to design a loop to step frequencies through a range established in a lookup table, but ran into an apparent PBasic limitation. Each step of the chirp must be better than 1ms, which seems to be the lower end of the FREQOUT capability. Does anyone know how to create PWM pulses of less than 1ms?

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2007-05-10 19:23
    Yes, but not with a BS2. You might be able to use a 555 based circuit with a 'PULSOUT'.
  • hitswarehitsware Posts: 156
    edited 2007-05-10 21:43
    Do you need sinewaves ?

    If not you might look at the PWMPAL.

    Pretty nifty device.
  • Andy McLeodAndy McLeod Posts: 40
    edited 2007-05-11 00:47
    I had looked at the PWMPAL, but the documentation suggests it's limited to 20kHz. I need a minimum of 30kHz and up to 50kHz.
  • hitswarehitsware Posts: 156
    edited 2007-05-11 00:53
    Sinewaves or squarewaves ?
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2007-05-11 01:24
    The duration parameter for FREQOUT on the BS2px is 0.166 millisecond, not 1 ms, but a loop structure to do any kind of frequency sweep on the Stamp always interrupts the sound and creates a low frequency rumble component. Maybe you can turn that into a feature?! FREQOUT takes two frequency parameters and the mixture of two can create a low frequency beat note and probably also a high frequency image. I don't know if that would be useful.

    The full cycle duration of PWM on the BS2px is 0.4 millisecond.

    One piece of hardware that might help to tame the sweep would be a PLL, maybe a simple 8-pin tone decoder like the LMC567. Set it to the target frequeny, and then use the Stamp sweep it to to a nearby frequencies. It could sort of free wheel during the time the Stamp is looping.

    Another option would be to move to a Propeller chip, and generate the main frequency with one of the counter modules.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • metron9metron9 Posts: 1,100
    edited 2007-05-11 12:17
    What is the minimum and maximum time of the chirp.
    From 30khz to 50khz what is the resolution you need how many steps in between 30khz and 50khz

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think Inside the box first and if that doesn't work..
    Re-arrange what's inside the box then...
    Think outside the BOX!
  • Andy McLeodAndy McLeod Posts: 40
    edited 2007-05-11 18:47
    Well, thanks for all the input. The customer is happy with the chirp as produced by this structure:

    FREQOUT 0,3,4146

    FREQOUT 0,3,4478



    ... and so on for a stepped chirp.



    Now, if I can figure out how to continually·trigger on a 1hz·PPS from a GPS, I'm on the done!
  • hitswarehitsware Posts: 156
    edited 2007-05-11 23:28
    Andy McLeod said...

    Well, thanks for all the input. The customer is happy with the chirp as produced by this structure:

    FREQOUT 0,3,4146

    FREQOUT 0,3,4478



    ... and so on for a stepped chirp.



    Now, if I can figure out how to continually·trigger on a 1hz·PPS from a GPS, I'm on the done!

    Congratulations ! Very near your target of 30 kHz ...... [noparse]:)[/noparse]

    I bet it works well ......
  • jasonsp6jasonsp6 Posts: 2
    edited 2007-05-12 00:36
    Andy McLeod said...



    Now, if I can figure out how to continually trigger on a 1hz PPS from a GPS, I'm on the done!

    Most OEM GPS modules have a 1hz PPS TTL output. You can use that to trigger your Basic Stamp on an input pin. The other option would be to parse the serial stream from the GPS.
  • hitswarehitsware Posts: 156
    edited 2007-05-12 00:47
    >parse the serial stream

    Please elaborate......
Sign In or Register to comment.