Shop OBEX P1 Docs P2 Docs Learn Events
hz reader and switching — Parallax Forums

hz reader and switching

prochipsprochips Posts: 6
edited 2007-03-24 03:37 in BASIC Stamp
hello
I·trying to·write the code for bs2 oem·,· for reading hz of 5v square wave and later trigger relay if the Freq is > 120hz
but dosent work

·thanks
·wilson

Post Edited (prochips) : 3/21/2007 4:44:12 AM GMT
538 x 382 - 9K

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2007-03-21 12:09
    Wilson,

    Everything looks OK.

    Are you sure the the square wave is actually swinging the stamp pin 15 from 0 to 5v? Also, is the negative from the square wave source tied to the stamp's negative?

    You can reduce the 10K resistor down to 100 ohms or so when inputing a ttl signal.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-03-21 12:57
    I see no ground input indicated -- have you connected a ground as well as the desired signal?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-03-21 15:06
    How many pulses per revolution does your motor produce? If it's one — not four — you need to compute RPM as follows:

    RPM = Pulses * 120
    
    
    



    The same applies to the frequency. Since you're counting for 1/2 second, the frequency you want to check will equal pulses * 2, not pulses.

    And finally, in your code, when the value being checked equals 100, the state of the LED doesn't change. Is that what you intended?

    -Phil
  • prochipsprochips Posts: 6
    edited 2007-03-24 03:37
    ok ,I need conect ground to input signal
Sign In or Register to comment.