Shop OBEX P1 Docs P2 Docs Learn Events
BS2P help! — Parallax Forums

BS2P help!

Five-sEvEnFive-sEvEn Posts: 7
edited 2004-12-20 17:11 in BASIC Stamp
Hi, this is kinda stupid but, I bought a BS2P24 in August and only had time to full test it out now. For some reason it's clock or something seems messed up. I can transfer programs just fine, but when I try to run a simple motor program (to move forward) with my BOEbot it just spins in place, and with the same code on my BS2 it works just fine. Also running the communication test program with the BS2P24 and my CMUcam doesn't work either, while it works just fine with BS2

Testing it late is kinda stupid because I can't return it or anything now (past the 90 days already), and I was just wondering if anyone else had the same or similar problems?

Comments

  • JoltnjoeJoltnjoe Posts: 12
    edited 2004-12-15 04:11
    I had the same problem running Continuous running servo's

    I went back to the BS2 I got the BS2P for LCD Drive

    The Stamp Manual shows that it is meant for the PULSOUT Command

    I wanted to post the same message

    Thank You
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-12-15 05:45
    Probably operator error. The BS2p runs about 3x faster than the BS2 and you must make some code adjustments for the speed difference -- PUSLOUT, for example, uses different timing parameters between the two modules. The current help file shows how to use conditional compilation techniques to create code that is BASIC Stamp agnostic (works with any BS2-family module).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • Five-sEvEnFive-sEvEn Posts: 7
    edited 2004-12-15 06:30
    Ok after reading the 1st reply I played around with an increasing PULSOUT command, and found that I could get the motors to run straight at around something like 500 and 2500. I don't fully understand how the math of the timing for PULSOUT works. If my target PULSOUT period for a BS2 is 1.0ms then the equation would be 1000us=2us*Period right? If so, wouldn't the equation be 1000us=1.18us*Period for a BS2p? If that were the case, then the period for a BS2p with a 1ms pulse would be around 847 right? Same goes for 2ms, and if i'm correct, that would bring the period up to about 1694, which, in reality, does not reverse the direction of the servo. Can someone un-confuse me please?

    Even if that timing error in the PULSOUT command accounted for my programs not running quite straight, what would explain the lack of communication between the CMUcam and the BS2p? I changed the Baudmode (value = 240) on "Program 1" and it still fails to run.

    Here's what happens basically:
    CMUcam starts up
    BS2p sends "reset" command to CMUcam
    BS2p recieves "ack" from CMUcam
    BS2p sends "tracking LED on" command to CMUcam
    --Program Freezes here--
    Never recieves "ack" from CMUcam

    If I remove the SERIN commands from the BS2p then it works. I guess it likes to talk but never wants to listen. If I route the SERIN commands through Pin 16 (serial port) and manually send the "ack" commands it works though.

    Anyone might know what the problem here is?

    Post Edited (Five-sEvEn) : 12/15/2004 6:31:58 AM GMT
  • achilles03achilles03 Posts: 247
    edited 2004-12-15 12:26
    Sounds like your SERIN is getting stuck because it's not recieving the input. If that's the case, you might consider a timeout command...

    Can you post the code that went with it? I tried hacking into your computer to get it, but then decided it'd be easier to ask. wink.gif
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2004-12-15 15:42
    Also try breaking this down...See if you can get the servos working properly first before worrying about the CMUCam...Then try that by itself...Once you know everything works with the new timing parameters, then integrate the changes into your full code.· It might be that the way the code is written simply changing the timing won't necessarily make everything just start working.· You may need to add delays or timeouts, as achilles stated.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Knight Designs
    324 West Main Street
    P.O. Box 97
    Montour Falls, NY 14865
    (607) 535-6777

    Business Page:·· http://www.knightdesigns.com
    Personal Page:··· http://www.lightlink.com/dream/chris
    Designs Page:··· http://www.lightlink.com/dream/designs
    ·
  • Five-sEvEnFive-sEvEn Posts: 7
    edited 2004-12-15 16:19
    Ok here's the code taken directly off of the CMUcam CD and then used a replace command for the Baudmode number 84 and changed it to 240.


    ' Pause 1 second for CMUcam startup
    PAUSE 1000
    
    ' Send "reset" to sync CMUcam and Stamp
     SEROUT 10, 240, [noparse][[/noparse]"RS", CR]
     SERIN 9, 240, [noparse][[/noparse]WAIT (":")]
    
    Main:
    
    ' Flash the tracking LED
    
    ' Send command - Turn on track LED
    
    SEROUT 10, 240, [noparse][[/noparse]"L1 1",CR]
    SERIN 9, 240, [noparse][[/noparse]WAIT (":")]
    
    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
    



    The original code works just fine with my BS2 but the BS2p stops after sending the "Turn on track LED" command. If i'm not mistaken, the PAUSE and serial commands don't require any other timing changes except for the Baudmode in the serial commands case.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2004-12-15 17:15
    Five-sEvEn -

    I just checked some sample CMUCam code from the Parallax web site, and it contains the following initialization code which is not included in the code you have provided:

    ' Pause 1 second for CMUcam startup
    PAUSE 1000

    ' Send "reset" to sync CMUcam and Stamp
    SEROUT 10, 84, [noparse][[/noparse]"RS", CR]
    SERIN 9, 84, [noparse][[/noparse]WAIT (":")]

    If you have not initialed the CMUCam, you may wish to included the code above with the appropriate modifications for your specific implementation. In the limited code snippet you have included, it doesn't appear as there are any other statements which need to be changed due to the speed differences between the two Stamp platforms.

    Regards,

    Bruce Bates
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2004-12-15 21:03
    Bruce may have the answer to your question.· But so that you're not wondering why I mentioned the delay thing, I remember some time ago a post about some add-on device (I don't remember which one), which would initialize fine on the BS2, but when moved to the BS2SX or BS2P a delay would need to be added between the SEROUT and SERIN commands.· It was either that or a timeout was added to the SERIN.· But as I recall, the point was that the BS2P/SX were faster and would miss the reply from the device, hence the delay/timeout.· Make sense?

    blush.gif·· Sometimes I don't even make sense to myself!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Knight Designs
    324 West Main Street
    P.O. Box 97
    Montour Falls, NY 14865
    (607) 535-6777

    Business Page:·· http://www.knightdesigns.com
    Personal Page:··· http://www.lightlink.com/dream/chris
    Designs Page:··· http://www.lightlink.com/dream/designs
    ·
  • Five-sEvEnFive-sEvEn Posts: 7
    edited 2004-12-16 04:38
    Bruce:
    I'm not sure if you can see it or not but, the first 6 lines of code that I provided are the exact initialization code for the CMUcam with Baudmode modifications for the BS2p.

    Chris:
    The SERIN commands have WAIT modifiers in them. Granted, this is the first time i'm messing with serial communication, but i'm gonna go ahead say that if it waits for an ascii ":" then it should stay on that command and continue to wait untill the "ACK:" signal from the CMUcam.
  • dandreaedandreae Posts: 1,375
    edited 2004-12-18 23:53
    If you are using 4 AA batteries, the BS2p uses 40mA on the run and add that with the CMU cam and other devices, you may need to check your batteries or increase your battery pack.

    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    www.parallax.com

    ·
  • Five-sEvEnFive-sEvEn Posts: 7
    edited 2004-12-20 04:07
    I tried both with using the AA battery pack and an AC adaptor (monitered the voltage with the AC adaptor) and no fluctations, so I don't thats the problem.
  • dandreaedandreae Posts: 1,375
    edited 2004-12-20 16:58
    I think found the problem, I noticed that you are using 1.18uS for the PULSOUT period and it should be .75uS.· There is a mis-print in the BASIC Stamp manual.

    Dave


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    www.parallax.com

    ·
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-12-20 17:11
    To Dave's point, the online Help file will always have the latest, most correct information on PBASIC syntax and specifics.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
Sign In or Register to comment.