Shop OBEX P1 Docs P2 Docs Learn Events
problems with CMU cam — Parallax Forums

problems with CMU cam

ArchiverArchiver Posts: 46,084
edited 2003-03-04 15:41 in General Discussion
Michael-

Here's a guess. The ':' is being transmitted while your "debug
"serout done",cr statement is executing, so it has already happened
before your Stamp begins looking for it. Kind of like trying to
catch up with a fast ball that is already in the catcher's mitt. Try
it without that statement and see what happens.

FWIW, DEBUG works at 9600 baud, so each byte/character you transmit
consumes slightly over 1 millisecond. Your DEBUG statement above
would take more than 0.0125 seconds just in transmission time if my
occasionally-reliable arithmetic is correct.

Regards,

Steve

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-03-04 14:54
    Michael,

    A quick look at the Parallax documentation for their version of the CMUcam
    shows that their usage of the SEROUT and SERIN commands (that wait for the
    colon) do not have any intervening program code.

    I suspect that what is happening is that your DEBUG statements take
    sufficient time that the CMUcam's response is "lost" in the bit-bucket
    before the SERIN command gets started to process (there is no buffer on the
    SERIN).

    So, Try removing all program code between the SEROUT and the corresponding
    SERIN with the "wait" option.

    You might also try using the timeout option on the SERIN, if that is
    appropriate to your application.

    HTH,
    Daniel

    Original Message
    From: omnigroup_2002 <ord_data@h...>
    [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=CiOVATw6-B_5gAwQ2wDr6QDazCqAFx_Vr2MWRjSNCCqRdfZGOWrxi3TunpzCTjo0CPVtA39ApSmbiHXG]ord_data@h...[/url
    Sent: Tuesday, March 04, 2003 4:34 AM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] problems with CMU cam


    I seem to be having problems with getting a CMU cam to communicate
    with BoeBot. I have connected the wires according to the
    documentation, transmit on pin 10 and receive on pin9 but for some
    reason the program stalls on serin 9,240,[noparse][[/noparse]WAIT (":")] Anyone have
    any ideas that could be causing this. I have the whole code below as
    it isn't long and is part of initial checks.

    -Michael

    '{$STAMP BS2p}
    '{$PBASIC 2.5}

    '
    Initialization beep
    '
    output 2
    freqout 2, 2000, 2000

    Main:
    ' Flash the tracking LED
    ' Send command - Turn on track LED
    debug "LED test",CR
    serout 10, 240, [noparse][[/noparse]"L1 1",CR]
    debug "serout done",cr
    serin 9, 240, [noparse][[/noparse]WAIT (":")]
    debug "serin done",cr

    debug "LED on ACK: received OK",CR
    ' Wait 1/2 second
    Pause 500
    ' Send command - Set track LED back to auto mode
    serout 10, 240, [noparse][[/noparse]"L1 2",CR]
    serin 9, 240, [noparse][[/noparse]Wait (":")]
    debug "LED off ACK: received OK",CR
    ' Wait 1/2 second
    Pause 500
    Goto Main



    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2003-03-04 15:41
    Okay, I understand what you both say about the debug causing a timing
    error with the SERIN command, but those weren't originally there
    either. I added them to determine whether it was SEROUT or SERIN
    that was problematic. That is when I figured that the SERIN is not
    responding - could it be a transmission problem on the camera side?
    As for the timeout feature, I can implement it on this particular
    part but my main program will require information from the camera to
    be stored and if SERIN doesn't, it kind of causes problems.

    - Michael


    --- In basicstamps@yahoogroups.com, "D. Daniel McGlothin" <ddm@m...>
    wrote:
    > Michael,
    >
    > A quick look at the Parallax documentation for their version of the
    CMUcam
    > shows that their usage of the SEROUT and SERIN commands (that wait
    for the
    > colon) do not have any intervening program code.
    >
    > I suspect that what is happening is that your DEBUG statements take
    > sufficient time that the CMUcam's response is "lost" in the bit-
    bucket
    > before the SERIN command gets started to process (there is no
    buffer on the
    > SERIN).
    >
    > So, Try removing all program code between the SEROUT and the
    corresponding
    > SERIN with the "wait" option.
    >
    > You might also try using the timeout option on the SERIN, if that is
    > appropriate to your application.
    >
    > HTH,
    > Daniel
    >
    >
    > '{$STAMP BS2p}
    > '{$PBASIC 2.5}
    >
    > '
    Initialization beep
    '
    > output 2
    > freqout 2, 2000, 2000
    >
    > Main:
    > ' Flash the tracking LED
    > ' Send command - Turn on track LED
    > debug "LED test",CR
    > serout 10, 240, [noparse][[/noparse]"L1 1",CR]
    > debug "serout done",cr
    > serin 9, 240, [noparse][[/noparse]WAIT (":")]
    > debug "serin done",cr
    >
    > debug "LED on ACK: received OK",CR
    > ' Wait 1/2 second
    > Pause 500
    > ' Send command - Set track LED back to auto mode
    > serout 10, 240, [noparse][[/noparse]"L1 2",CR]
    > serin 9, 240, [noparse][[/noparse]Wait (":")]
    > debug "LED off ACK: received OK",CR
    > ' Wait 1/2 second
    > Pause 500
    > Goto Main
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    Subject and
    > Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
Sign In or Register to comment.