Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamps — Parallax Forums

Basic Stamps

chesskingchessking Posts: 5
edited 2013-05-24 14:13 in BASIC Stamp
I have a basic stamp 2 and if i got another type stamp that had more slots would I have to relearn the programing to program that stamp to do what I wanted?
-- Chessking

Comments

  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-05-22 14:07
    You would not have to relearn PBasic as it works with all stamps. However, depending on the Stamp used you would need to change any mathematical and or Time values to what your Stamp version is. If you search for Case in PBasic Help and look under Freqout Examples you will see what I am talking about.
    Spkr            PIN     10              ' output pin for FREQOUT
    
    #SELECT $STAMP
      #[COLOR=#000000][B][COLOR=#000000][B][COLOR=#000000][B]CASE[/B][/COLOR][/B][/COLOR][/B][/COLOR] BS2, BS2E
        TmAdj       CON     $100            ' x 1.0 (time adjust)
        FrAdj       CON     $100            ' x 1.0 (freq adjust)
      #[COLOR=#000000][B][COLOR=#000000][B]CASE[/B][/COLOR][/B][/COLOR] BS2SX
        TmAdj       CON     $280            ' x 2.5
        FrAdj       CON     $066            ' x 0.4
      #[COLOR=#000000][B]CASE[/B][/COLOR] BS2P
        TmAdj       CON     $3C5            ' x 3.77
        FrAdj       CON     $044            ' x 0.265
      #[COLOR=#000000][B][COLOR=#000000][B][COLOR=#000000][B]CASE[/B][/COLOR][/B][/COLOR][/B][/COLOR] BS2PE
        TmAdj       CON     $100            ' x 1.0
        FrAdj       CON     $0A9            ' x 0.66
      #[COLOR=#000000][B][COLOR=#000000][B]CASE[/B][/COLOR][/B][/COLOR] BS2PX
        TmAdj       CON     $607            ' x 6.02
        FrAdj       CON     $02A            ' x 0.166
    #ENDSELECT
    
  • chesskingchessking Posts: 5
    edited 2013-05-22 17:50
    NWCCTV wrote: »
    You would not have to relearn PBasic as it works with all stamps. However, depending on the Stamp used you would need to change any mathematical and or Time values to what your Stamp version is. If you search for Case in PBasic Help and look under Freqout Examples you will see what I am talking about.
    Spkr            PIN     10              ' output pin for FREQOUT
    
    #SELECT $STAMP
      #[COLOR=#000000][B][COLOR=#000000][B][COLOR=#000000][B]CASE[/B][/COLOR][/B][/COLOR][/B][/COLOR] BS2, BS2E
        TmAdj       CON     $100            ' x 1.0 (time adjust)
        FrAdj       CON     $100            ' x 1.0 (freq adjust)
      #[COLOR=#000000][B][COLOR=#000000][B]CASE[/B][/COLOR][/B][/COLOR] BS2SX
        TmAdj       CON     $280            ' x 2.5
        FrAdj       CON     $066            ' x 0.4
      #[COLOR=#000000][B]CASE[/B][/COLOR] BS2P
        TmAdj       CON     $3C5            ' x 3.77
        FrAdj       CON     $044            ' x 0.265
      #[COLOR=#000000][B][COLOR=#000000][B][COLOR=#000000][B]CASE[/B][/COLOR][/B][/COLOR][/B][/COLOR] BS2PE
        TmAdj       CON     $100            ' x 1.0
        FrAdj       CON     $0A9            ' x 0.66
      #[COLOR=#000000][B][COLOR=#000000][B]CASE[/B][/COLOR][/B][/COLOR] BS2PX
        TmAdj       CON     $607            ' x 6.02
        FrAdj       CON     $02A            ' x 0.166
    #ENDSELECT
    
    sorry I don't understand would anything be different to program, or would I just have to change the version in the editor
  • ElectrodudeElectrodude Posts: 1,646
    edited 2013-05-22 18:27
    You would have to change the version number in the editor and some constants would have to be different i.e. different stamps use different units. For example:

    BS2:
    PULSEOUT 12, 750

    BS2PX:
    PULSEOUT 12, 1875

    These two lines both do the same thing, emit a 1300µs pulse on pin 12, but the pulse width unit for BS2 is 2.0µs while it is 0.8µs for the BS2PX.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-05-22 18:36
    In other words, look at the multiplier. A BS2SX is 2.5 times faster than a BS2 for Timing and .4 times faster for Freq adjustment. A BS2P is 3.77 and .265, a BS2PE is same timing but .66 on Freq adjustment and a BS2PX is 6.02 and .166. You can either do the multiplication yourself when inputting values in to your code or you can use the Case Statement.
  • ercoerco Posts: 20,256
    edited 2013-05-22 21:08
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-05-22 21:31
    @erco, Thanks, I just forgot to throw that one in since it is in the same line in the Case code as the BS2.
  • chesskingchessking Posts: 5
    edited 2013-05-23 04:04
    erco wrote: »
    so if i got a bs2e i would program exactly the same but i would have more slots?
  • Mike GreenMike Green Posts: 23,101
    edited 2013-05-23 06:28
    Yes, the only thing you'd have to change in your program is the $STAMP directive so the Stamp Editor will know that you're using a BS2e instead of a BS2. All of the timings will be the same. You'll get additional slots and you'd get some scratchpad RAM to use with the GET and PUT statements.
  • chesskingchessking Posts: 5
    edited 2013-05-23 14:55
    Mike Green wrote: »
    Yes, the only thing you'd have to change in your program is the $STAMP directive so the Stamp Editor will know that you're using a BS2e instead of a BS2. All of the timings will be the same. You'll get additional slots and you'd get some scratchpad RAM to use with the GET and PUT statements.
    how do you switch between slots?
    and is there any way to buy a bs2e alone without buying anything else
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2013-05-23 15:08
    Do consider moving to one of the Stamps in the "p" series, instead of to the BS2e. The p series offers more scratchpad RAM space for extra variables, easy transfer of data between the slots, and easy interface to things like devices that use the i2c or one-wire protocols. The BS2pe in many respects has the same timing as the original BS2, especially for the serial commands. What do you want to do?
  • Mike GreenMike Green Posts: 23,101
    edited 2013-05-23 15:12
    Look at the Nuts and Volts article mentioned (here) for information on the GET, PUT, and RUN statements. The Basic Stamp Syntax and Reference Manual also discusses these statements and how to use the $STAMP directive to load programs into specific slots.

    You can buy any of the Stamp modules from Parallax's webstore. If you have a board like the Stamp Board of Education or the Super Carrier Board or any of the 3rd party boards designed to plug in a Stamp module, you can use the BS2e or other Stamp model in the socket supplied. You can also make your own board with a 24-pin IC socket and connect the module as shown in the Reference Manual.
  • chesskingchessking Posts: 5
    edited 2013-05-24 13:56
    Mike Green wrote: »
    Look at the Nuts and Volts article mentioned (here) for information on the GET, PUT, and RUN statements. The Basic Stamp Syntax and Reference Manual also discusses these statements and how to use the $STAMP directive to load programs into specific slots.

    You can buy any of the Stamp modules from Parallax's webstore. If you have a board like the Stamp Board of Education or the Super Carrier Board or any of the 3rd party boards designed to plug in a Stamp module, you can use the BS2e or other Stamp model in the socket supplied. You can also make your own board with a 24-pin IC socket and connect the module as shown in the Reference Manual.
    how would I switch between slots with a bs2
  • Mike GreenMike Green Posts: 23,101
    edited 2013-05-24 14:13
    You can't. The BS2 has only the one slot, so there's no switching. All the other models (BS2e, BS2sx, BS2p/pe/px) have multiple slots and statements to use them. The BS2p series has some statements that the BS2e and BS2sx don't have that add extra abilities and simplify slot use. Look at the Nuts & Volts Column I mentioned earlier for specifics on this.
Sign In or Register to comment.