Shop OBEX P1 Docs P2 Docs Learn Events
any one can explain it to me???? — Parallax Forums

any one can explain it to me????

HinoHino Posts: 1
edited 2008-02-14 18:00 in BASIC Stamp
hi!...please explain further this code...
this is for HM55Bcompass module....and i'm using BS2
at calibration:
index = 8
table(current) = 0: table(previous) = 0
DO
··· index = 8
··· READ CompassCal + index, table(current)
··· READ CompassCal + (index - 1 & $F),· table(previous)
LOOP Until table(current) < table(previous)
WRITE CompassLowVal, index
at test calibrated:

READ CompassLowVal, index·· ·· ·· ·· what is this? is it equal to 1?



READ CompassCal + index, table(current)······· and this one what is this?

READ (CompassCal + (index - 1 & $F)), table(previous)········ also this one?

what is table(current) & table(previous) ????

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-02-14 18:00
    Hino,

    The first line you asked about is reading the current value of the EEPROM location at the address specified by CompassLowVal into the variable index. The value stored there could change, so if you want to know what’s there you would have to DEBUG the value being read.

    The second line reads data from the EEPROM at the address specified by CompassCal plus the value of index and places it into the array table at the (current) index. Current and Previous are index variables referring to the position within the specified array. I hope this helps. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.