Shop OBEX P1 Docs P2 Docs Learn Events
what's the difference between BS2 and BS2p — Parallax Forums

what's the difference between BS2 and BS2p

qiuqiuaaaqiuqiuaaa Posts: 37
edited 2011-12-05 23:29 in General Discussion
I bought a new compass module "HMC5883L", and I use Basic Stamp 2. The sample program provided on product page is on BS2p. It can not be run on my stamp. I want to know the difference and how to modify the program. Thank you.
Main problem is here:

SDA PIN 0 'P0 transceives to/from SDA
SCL PIN 1 'P1 sends clock pulses
WRITE_DATA CON $3C 'Used to perform a Write operation
READ_DATA CON $3D 'Used to perform a Read operation
MODE CON $02 'Read/Write Register, Selects the operating mode. Default = Single measurement
Cont_Mode CON $0
I2COUT SDA, WRITE_DATA, MODE, [Cont_Mode] ' Send continuous output command

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-12-01 20:48
    The compass module uses the I2C protocol. The BS2p has built-in statements like I2COUT to handle the I2C protocol. The BS2 doesn't have these statements, but it can still use I2C devices by doing the same things using subroutines. There's a Nuts and Volts Column (#115 here) that discusses this, provides listings of these subroutines, and explanations and examples of their use.
  • qiuqiuaaaqiuqiuaaa Posts: 37
    edited 2011-12-01 22:58
    Mike Green wrote: »
    The compass module uses the I2C protocol. The BS2p has built-in statements like I2COUT to handle the I2C protocol. The BS2 doesn't have these statements, but it can still use I2C devices by doing the same things using subroutines. There's a Nuts and Volts Column (#115 here) that discusses this, provides listings of these subroutines, and explanations and examples of their use.
    Thank you very much! I am only a beginner, not familiar with protocol. It is quite difficult for me to understand the codes, but I will try to learn. Thanks.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-12-02 00:12
    The BS2 has the advantage of requiring the least amount of power of all the BS2xx series. If you need to conserve battery life, it is the most useful.

    The BS2p offers more built-in functions and more program storage and faster operation.

    There are excellent reasons to own both. While BS2 doesn't have I2C as a built-in, you can construct code to use it. And the same goes if you choose to use an LCD. About the other limit is that the BS2 uses slower RS232 protocols. The Basic Stamp Manual has a good comparison chart.
  • qiuqiuaaaqiuqiuaaa Posts: 37
    edited 2011-12-05 18:31
    The BS2 has the advantage of requiring the least amount of power of all the BS2xx series. If you need to conserve battery life, it is the most useful.

    The BS2p offers more built-in functions and more program storage and faster operation.

    There are excellent reasons to own both. While BS2 doesn't have I2C as a built-in, you can construct code to use it. And the same goes if you choose to use an LCD. About the other limit is that the BS2 uses slower RS232 protocols. The Basic Stamp Manual has a good comparison chart.
    Thank you! How about BS2px, can I use it instead of BS2p?
  • Mike GreenMike Green Posts: 23,101
    edited 2011-12-05 18:58
    Yes, you can use a BS2px instead of a BS2p. As is true for all Stamp models, the speed of the Stamp may be a little different and some of the speed-dependent constants, like those used to set the Baud for serial I/O, are different. Consult the Stamp Manual for specific values. The BS2px also has a few statements that the other models don't have.
  • qiuqiuaaaqiuqiuaaa Posts: 37
    edited 2011-12-05 23:29
    Mike Green wrote: »
    Yes, you can use a BS2px instead of a BS2p. As is true for all Stamp models, the speed of the Stamp may be a little different and some of the speed-dependent constants, like those used to set the Baud for serial I/O, are different. Consult the Stamp Manual for specific values. The BS2px also has a few statements that the other models don't have.
    OK. Thank you very much.
Sign In or Register to comment.