scale code
mmoreland
Posts: 89
I was using a dual axis accelerometer (mimsic 2125) with a BS2p. After switching to a BS2pe, it no longer reported the correct angle. The scale code that appears in the literature ($1E1) seems to be incorrect. I'm using the rotational angle code straight from the download from the Parallax product page. Any ideas what I'm doing wrong, or any ideas what the scale code should be?
Comments
Jeff T.
EDIT: the units of measurement for the BS2pe are 2uS and for the BS2p 0.8uS a ratio of ~1 : 2.5, the ratio of $1E1 to $0C0 is also 1 : 2.5
Jeff T.
EDIT: the numbers $200 and $0CC are values used with the "multiply middle" operator( */ ) check it out in the PBasic help file
Yes I would think $200 for the BS2pe but for your results to match what you had on the BS2p then the BS2p should have had $0CC not $0C0 ($CC = 0.79uS and $C0 =0.75uS when your aiming for 0.8uS)
Jeff T.
The following link is to the Basic Stamp Syntax and Reference Manual download. The multiply middle operator is described on page 112
http://www.parallax.com/tabid/440/Default.aspx
A quick note on $200 and $0CC which represent 2 and 0.8 respectively (which the section on multiply middle explains) and how it is used with the Memsic.
The Memsic documentation gives an example using a BS2 where it says if the accelerometer is laying flat the Debug screen will display ~2500. The 2500 is the number of units in the measured pulse duration. Each unit for the BS2 (and the BS2pe) is 2 microseconds therefore 2500 x 0.000002 = 0.005 (5 milliseconds). That is the measured pulse width.
If using the BS2p the units are not 2 microseconds they are 0.8 microseconds therefore for the same 5 millisecond pulse you should get 6250 counts. To prove this 6250 x 0.8 = 0.005 (5 milliseconds).
Thats where the "scale" in the Memsic code is derived from.
Jeff T.