Shop OBEX P1 Docs P2 Docs Learn Events
Help understanding a couple of lines. adc0831 — Parallax Forums

Help understanding a couple of lines. adc0831

spinefan03spinefan03 Posts: 10
edited 2015-01-23 18:00 in Propeller 1
Hello all,

I recently manipulated the adc0831_DEMO to function correctly using the adc TLC5489. Everything is working correctly, I just have two lines that I am not sure of the purpose. Changing these values give me unexpected results (obviously, if I had no idea what to expect in the first place)

Could someone give me a clue as to why everything seems to be functioning flawlessly?

data := 0 ' This will accumulate the resulting value

data <<= 1 ' Multiply data by two

Thank you for any help.

Ryan

Comments

  • JonnyMacJonnyMac Posts: 9,105
    edited 2015-01-23 17:34
    It would be helpful for you to include the entire routine so that one could determine context.

    The first line is clearing the accumulator.

    The second line is shifting the bits in data to the left -- I'm assuming the data is arriving MSB first; the shift moves previous bits and makes room in bit0 for the new one.
  • spinefan03spinefan03 Posts: 10
    edited 2015-01-23 18:00
    Thank you much. I had thought another line was moving the bits over, now everything makes sense. Thank you for everything that you do... I find myself using your objects for reference frequently.
Sign In or Register to comment.