Shop OBEX P1 Docs P2 Docs Learn Events
bs1 freqout workaround — Parallax Forums

bs1 freqout workaround

jasonhjasonh Posts: 5
edited 2008-03-15 17:46 in BASIC Stamp
I have a bs1 and i am trying to use an infrared emitter/receiver pair to determine when an object passes between them.

the problem is that there does not seem to be a FREQOUT command in the BS1 syntax.

Is there an equivalent command or prehaps a way of 'spoofing' a frequency on the BS1 or did I just buy the wrong stamp for my application?

I've tried PULSOUT, SOUND and bringing the pin HIGH but no change in the receiver state yet.

i have 2 IR emitter/receiver pairs and the emiters are powered by a switch on PIN1 heres the code i have.

' {$STAMP BS1}
' {$PBASIC 1.0}

'0 = serial
'1 = reset switch
'2 = rec a
'3 = rec b
'4 = emm a
'5 = emm b
'6 =
'7 =

SYMBOL tempsig1 = W2
SYMBOL tempsig2 = W3
DEBUG  "operating"
INPUT PIN1
INPUT PIN2
INPUT PIN3
PAUSE 1000
DEBUG CLS

main:
tempsig1 = PIN2
tempsig2 = PIN3
IF PIN1 = 0 THEN switch  '
DEBUG CLS,"off: ", #tempsig1, "  " , #tempsig2
GOTO main

switch:
SOUND 4,(255,10)
tempsig1=PIN2
SOUND 5,(255,10)
tempsig2=PIN3
DEBUG CLS,"on: ",#tempsig1, "  " , #tempsig2
PAUSE 100
GOTO main

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-07 20:38
    The SOUND statement is the closest thing to FREQOUT on the BS1. You can also do slow frequencies in a loop. The best solution for you is to use a 555 timer in asynchronous mode to generate the 38KHz pulses for the IR Emitter. There are sample circuits in the "IR Remote Control for the BoeBot" tutorial or in pretty much any collection of sample circuits for the 555 on the internet.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2008-03-07 21:44
    astable
  • jasonhjasonh Posts: 5
    edited 2008-03-07 22:25
    went through the enitre range of the SOUND command, from 0-->255 and delays from 0 to 10.... no response from the IR Receiver (stays HIGH).

    tested the whole rig on the BS2.. works fine.. why is SOUND so different from FREQOUT?
    PJ ALLEN said...
    astable
    what the ?


    I guess ill look up using the 555.. any pointers would be helpful and appreciated
  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-08 04:37
    PJ, I need to wake up before trying to answer e-mail and wandering through the forums.

    jasonh,
    SOUND is intended to produce audible sounds, not arbitrary frequencies like 38KHz. Look on pages 190-192 of "IR Remote for the BoeBot" for a typical 555 circuit for 38.5KHz IR production.
  • jasonhjasonh Posts: 5
    edited 2008-03-08 08:35
    thanks, got it. Ill make up the circuit and let you know how it worked out...
  • jasonhjasonh Posts: 5
    edited 2008-03-14 21:29
    found someone with a PIC programmer and used the 12F683 to generate a 38500Hz signal to the IR whenever the output pin to the BS1 was set HIGH.
    problem solved.

    I had never used the BS1 in any application before, and to potential purchasers... the functonality of this chip is severely limited compared to the BS2.

    word of warning.
  • Dave-WDave-W Posts: 94
    edited 2008-03-15 01:55
    Hello Jasonh,
    Boy have I heard that before!
    The limits of any chip is the limits of the programmer, period. Do not think the BS-1 is anything less than a tool that does marvelous things in the right hands. I am sure there is someone out there that could have solved your problem with simple code, a little hardware and some work, at least to them. Don't short change the BS-1. But I agree the BS-2 is a better choice. The BS-1 has been around a long time and will continue for quite awhile longer.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    D. A. Wreski
  • jasonhjasonh Posts: 5
    edited 2008-03-15 17:05
    way to fly off the handle there dave. BTW, I did solve my problem,

    ...with a little code (all the bs1s memory will allow)
    ...with a little (secondary) hardware


    as for ...
    dave said...
    The limits of any chip is the limits of the programmer, period.

    I expect that you were able to port WindowsVista to the BS1, eh? no? .. Hmmm.

    Post Edited (jasonh) : 3/15/2008 5:15:49 PM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-15 17:46
    Yeah, the BS1 is neither anywhere as fast nor as versatile as the BS2, but it's more than adequate for a host of control applications.
    It's a matter of choosing the right tool for the job or (as you've done) adding a little something extra to the tool to help it do the job.

    For that matter, I would start with something like the BS2p or BS2px for a Stamp project because of the extra statements not
    in the BS2/BS2e/BS2sx and the extra speed and memory. If the 3.3V I/O isn't more work than it saves, I'd actually start with a
    Propeller Protoboard since it's very powerful and pretty cheap, particularly since I already have several PropClips it's only $20 a pop.
Sign In or Register to comment.