Shop OBEX P1 Docs P2 Docs Learn Events
Square Wave Frequency Conversion — Parallax Forums

Square Wave Frequency Conversion

randyrwrandyrw Posts: 5
edited 2006-03-04 03:18 in BASIC Stamp
What would be the best way to use the Stamp to output square wave frequencies?
I want to read a square wave frequency ranging from 0-5Khz and output it with a varible offset based on a percentage. Example:· 2500hz in and x10% out. I'm new at this so bare with me.

thanks
Randy

Post Edited By Moderator (Chris Savage (Parallax)) : 3/3/2006 4:08:55 AM GMT

Comments

  • Piper984Piper984 Posts: 74
    edited 2006-03-03 14:15
    Hi Randy,

    You might already know this, but incase you don't: You can use the PULSIN command twice to do frequency counting (crossing zero) of your input sigal. I think you could use the FREQOUT command and an opamp to square up an output signal. Let us know what you end up doing, as I am sure it would be of interest to folks.
  • randyrwrandyrw Posts: 5
    edited 2006-03-03 19:21
    Thanks for the info. Although I'm not sure how to do the PULSIN twice for freq counting. Could you give me a simple program command example?
    thanks
    Randy
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-03-03 19:23
    Randy,

    Do you want to measure square waves (easy) or produce them (not so easy)?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • randyrwrandyrw Posts: 5
    edited 2006-03-03 22:47
    I need to measure them, then offset the frequency by a varable amount, then produce them on a output. They will probably be pulses not perfect square wave.
    thanks
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-03-04 03:18
    The measurement is easy (you could use PULSIN or COUNT), the production of a square-wave is not going to be easy in [noparse][[/noparse]interpreted] PBASIC. This may be something better suited for the SX micro using assembly language.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.