Shop OBEX P1 Docs P2 Docs Learn Events
freqout program bs2 — Parallax Forums

freqout program bs2

electromanjelectromanj Posts: 270
edited 2006-10-30 22:03 in BASIC Stamp
Hello I have a question regarding frequout command on the bs2. I am sending a frequency of 38500 to an ir led. I am also trying to count output cycles from the ir reciever.·everything works well seperatly, but when i try the freqout and the count commands together it doesn't work because·it·sends the frequency before it starts to count. Is there a way to turn on an output frequency and leave it on permanently?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-10-30 19:39
    No.

    The Stamp is a single threaded processor. It can only do one thing at a time. If you need to do two things at the same time, you either need external hardware or another "co-processor" to do the second task. If the two things are slow enough so they can be interleaved, the Stamp can do it (like controlling 2 or 3 servos at the same time). If not, you will need a faster processor (like the SX series) or a multi-processor (like the Propeller which is also faster).
  • electromanjelectromanj Posts: 270
    edited 2006-10-30 19:43
    Thanks for the quick response! I will try another route.
  • Mike GreenMike Green Posts: 23,101
    edited 2006-10-30 19:52
    The easiest route would be to use a 555 timer set to pulse at 38500Hz and turn on and off from a Stamp pin. You could then count IR pulses with the Stamp (although you'd miss the first few just because of the delay from one statement to the next).

    I think the Robotics book in the Stamps in Class series shows how to use a 555 to do this.
  • electromanjelectromanj Posts: 270
    edited 2006-10-30 22:03
    I just happen to have a couple of 555s laying around. good idea thanks.
Sign In or Register to comment.