Shop OBEX P1 Docs P2 Docs Learn Events
New BS2P24 — Parallax Forums

New BS2P24

Earl FosterEarl Foster Posts: 185
edited 2004-12-23 18:18 in BASIC Stamp
Besides changing the directive in the source code from BS2 to BS2P is there anything else I need to do for my code to work properly?· The reason I ask is because I have been running a my robot with a BS2 module for a while now and after upgrading his stamp and re-running the code he didn't work right anymore.· All of his sensors went crazy.· As soon as I replaced the 2P with the original stamp he starting working again.· I also tryed the BS2P in my Hex and it had problems too.

Any ideas? Stamp bad maybe?

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-12-22 20:01
    Not a bad Stamp -- the BS2p is faster (by 3x) and some instructions will require parameter modification. If you post your code I will help, otherwise you can go through it line-by-line with the help file open to see what changes need to be made. The latter will serve you better in the long run, but my offer to help stands.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • Earl FosterEarl Foster Posts: 185
    edited 2004-12-22 21:15
    I appreciate your offer. I just need a check.

    With the BS2
    FOR counter = 1 TO 20
    PULSOUT 13, 650
    PULSOUT 12, 850
    NEXT

    With the BS2P
    FOR counter = 1 to 20
    PULSOUT 13, 384
    PULSOUT 12, 502
    NEXT
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-12-23 00:16
    Actually, you need to go the other direction.· In your orignal code you have a PULSOUT value of 650; on the BS2 this will create a pulse 1300 microseconds wide (@ 2 us per unit).· Take that 1300 us and divide by 0.8 us (units for the BS2p) and you get 1625.· Does that make sense?· So, you code for the BS2p should be:

    FOR counter = 1 to 20
      PULSOUT 13, 1625
      PULSOUT 12, 2125
    NEXT
    

    Let me also point out that your code will be easier to follow if you give your pins names, like this:

    LWheel    PIN    13
    RWheel    PIN    12
     
    ...
     
     
    FOR counter = 1 to 20
      PULSOUT LWheel, 1625
      PULSOUT RWheel, 2125
    NEXT
    


    With servos, you could even do this:

    MStop     CON    1875
     
     
    ...
     
     
    FOR counter = 1 to 20
      PULSOUT LWheel, MStop
      PULSOUT RWheel, MStop
    NEXT
     
    


    ·See how pin names and constant values make your code easier to follow?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • Earl FosterEarl Foster Posts: 185
    edited 2004-12-23 18:18
    Thanks for your assistance. Have a Merry Christmas
Sign In or Register to comment.