Shop OBEX P1 Docs P2 Docs Learn Events
Count, basic math, and create a frequency though programming? — Parallax Forums

Count, basic math, and create a frequency though programming?

EPhantom125EPhantom125 Posts: 4
edited 2008-04-10 18:26 in BASIC Stamp
I'm a highschool student and I need to make a stamp program to count the ripples in a·variable frequency for a certain ammount of time, then have it count again, find the difference in the numbers from the·frequencies. do a little bit more math. and put a clock signal out based on the math done before for the period of time that it counts the variable frequency... I know, a lot... any help? confused.gif

basicly I need to know...:

how to make it count
how to make it remember values
How to make it do math
and how to make it create a clock signal of a certain frequency

thankyou for your help

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-04-07 19:23
    First you need to learn how to program a Stamp. If you don't have it already, download copies of the "What's a Microcontroller?" tutorial and the Basic Stamp Manual, both from the Downloads section under the Resources tab on the Parallax website. Look in the Stamps in Class Tutorials Downloads area for the tutorial.

    To count ripples, you will need to change the input signal to a series of pulses which the Stamp can count with a COUNT statement. Do some research on the web on "sine wave to square wave"

    To make it remember values, you'll have to learn about variables and assignment (LET) statements from the manual

    To make it do math, you'll have to learn about arithmetic operators from the manual. For some kinds of complex math, there's good material on the www.emesystems.com website. Look under "app-notes".

    To create a clock signal of a certain frequency, it depends on the frequency. You can use the HIGH and LOW statements with a PAUSE statement. You'll have to read the sections in the manual on these statements. You can also use the FREQOUT statement for some frequencies.
  • EPhantom125EPhantom125 Posts: 4
    edited 2008-04-08 18:06
    "To count ripples, you will need to change the input signal to a series of pulses which the Stamp can count with a COUNT statement. Do some research on the web on "sine wave to square wave"
    Does the input signal have to be a square wave, or can I just put a diodebefore the input pin taking off negitive voltage?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-04-08 18:35
    You do need to remove the negative side of the waveforms. You also need some amplification so that all the sine waves will be high enough to cross the Stamp's voltage threshold, yet you don't want anything above 5V. A Schmidt trigger input gate is also helpful to prevent false triggering with the slowly changing sine waveform. A proper sine wave to square wave converter will take care of these issues.
  • EPhantom125EPhantom125 Posts: 4
    edited 2008-04-10 18:26
    I've had to change my project a little bit right after I got the stamp to count and assign the number as a variable...

    What I need the program to do, is to make it so I can get a time when the clock signal goes high so many times... the only reason why I am changing to this is because the previous method was· not efficient enough. (I'm having a hard time searching the manual to find the peices of script that I need)

    Again, thank you for your help

    Edit: I'm wondering if I can make it faster by making it tell me how long a clock signal is high for... any ideas?

    Post Edited (EPhantom125) : 4/11/2008 4:48:23 PM GMT
Sign In or Register to comment.