basicstampede

01-14-2007, 09:30 AM

Hello.

I have purchased the Memsic accelerometer.· While reading column 92, I noticed that the 5th page of this article (pg. 257) is largely blank.· It only has two lines at top and rest is blank.

Is something missing?

Can Parallax please correct this?·

Specifically, I'm trying to understand this snippet of code from the article and find it difficult to do so because of the missing page.

Can someone please explain how·the subroutine Read_X_Tilt·works, line by line?

More specifically, what is

xTilt = mult * (ABS xGForce / 10) + (frac ** (ABS xGForce / 10))·· for?

Read_X_Tilt:

· GOSUB Read_X_Force

· ' tilt = g x k

· '

· ' Select tilt conversion factor based on static

· ' G force.· Table data derived from Memsic specs.

· LOOKDOWN ABS xGForce, <=[174, 344, 508, 661, 2000], idx

· LOOKUP idx, [57, 58, 59, 60, 62], mult

· LOOKUP idx, [32768, 10486, 3277, 30802, 22938], frac

· ' G Force is divided by 10 to prevent roll-over errors at end

· ' of range.· Tilt is returned in 100ths degrees.

· xTilt = mult * (ABS xGForce / 10) + (frac ** (ABS xGForce / 10))

Check_SignX:

· IF (xGForce.BIT15 = 0) THEN XT_Exit·········· ' if positive, skip

· xTilt = -xTilt······························· ' correct for g force sign

XT_Exit:

· RETURN

I have purchased the Memsic accelerometer.· While reading column 92, I noticed that the 5th page of this article (pg. 257) is largely blank.· It only has two lines at top and rest is blank.

Is something missing?

Can Parallax please correct this?·

Specifically, I'm trying to understand this snippet of code from the article and find it difficult to do so because of the missing page.

Can someone please explain how·the subroutine Read_X_Tilt·works, line by line?

More specifically, what is

xTilt = mult * (ABS xGForce / 10) + (frac ** (ABS xGForce / 10))·· for?

Read_X_Tilt:

· GOSUB Read_X_Force

· ' tilt = g x k

· '

· ' Select tilt conversion factor based on static

· ' G force.· Table data derived from Memsic specs.

· LOOKDOWN ABS xGForce, <=[174, 344, 508, 661, 2000], idx

· LOOKUP idx, [57, 58, 59, 60, 62], mult

· LOOKUP idx, [32768, 10486, 3277, 30802, 22938], frac

· ' G Force is divided by 10 to prevent roll-over errors at end

· ' of range.· Tilt is returned in 100ths degrees.

· xTilt = mult * (ABS xGForce / 10) + (frac ** (ABS xGForce / 10))

Check_SignX:

· IF (xGForce.BIT15 = 0) THEN XT_Exit·········· ' if positive, skip

· xTilt = -xTilt······························· ' correct for g force sign

XT_Exit:

· RETURN