A question about code in SpinOneWire-test
ElectricAye
Posts: 4,561
Hello,
I've recently been working with SpinOneWire-test (thank you Micah Dowty!). It works great. But now I'm trying to understand how it works.
What baffles me is the use of this:
addr := @addrs + (i << 3)
I can see that this is a bitwise shift left operation. But why is it necessary?
It seems to do something to the 64-bit address of the DS18B20 that makes it possible to be used by the readTemperature method, but I can't figure out what it does.
thanks,
Mark
I've recently been working with SpinOneWire-test (thank you Micah Dowty!). It works great. But now I'm trying to understand how it works.
What baffles me is the use of this:
addr := @addrs + (i << 3)
I can see that this is a bitwise shift left operation. But why is it necessary?
It seems to do something to the 64-bit address of the DS18B20 that makes it possible to be used by the readTemperature method, but I can't figure out what it does.
thanks,
Mark
Comments
I guess you can see how thrilling my Friday nights are. I'm reduced to answering my own questions on a forum visited only by nerds.
somebody get me a doctor,
Mark
What would you rather be doing on a Friday night?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Michael Park
PS, BTW, and FYI:
To search the forum, use search.parallax.com (do not use the Search button).
Check out the Propeller Wiki: propeller.wikispaces.com/