With the help of
Guido Lutterbach I am about 85% able to get this chip to work.
He sent me a python code which works and uses no fancy library to function.
http://smartypies.com/projects/ads1115- ... 115runner/
I was able to understand enough of it that I am now getting changing values when I turn the potentiometer.
There is something called
Big Endian and
Little Endian which basically means that for some reason if you want to send
ABCD sometimes you need to send
CDAB because of how the Raspberry Pi handles things internally.
(
It makes no sense to me why this happens... but it does.)
To accomplish this feat, he uses this line of code in Python...
value = (value>>8 | value<<8) &=0xFFFF
I found this reference... but I don't understand what it is trying to tell me.
https://gambaswiki.org/wiki/comp/gb/stream/byteorder
Can someone here tell me what I need to do to accomplish this in Gambas?
(Translate the above into a command or short routine in Gambas.)
He is also doing some sort of 2's complement function to take the returned value and make it into a readable decimal... those are...
LEtoBE
Code: Select all
def LEtoBE(c):
c = swap2Bytes(c)
if(c >= 2**15):
c= c-2**16
return c
BEtoLE
Code: Select all
def BEtoLE(c):
if(c < 0):
c= 2**16 + c
return swap2Bytes(c)
Eventually I will learn enough python to fully understand this... but for the moment... if someone can translate... that would be freaking awesome.
Guido breaks it all down here... I'm just slowly getting it piece by painful piece.
http://smartypies.com/projects/ads1115- ... nd-python/
I did learn that I was using the wrong method to send the configurations... not realizing that the i2cWriteWordData( x , y , z) was NOT asking for the chip address again... I feel so silly now... but instead asking for:
i2cWriteWordData( Currently Open Bus , REGISTER TO WRITE , WORD TO GET WRITTEN)
So for now, I am going through the datasheet... writing down the BITS to make the CONFIGURATION, then manually swapping the BYTES and putting it into the code.
The numbers coming out are changing... and sometimes gibberish... but at least I know now that I need to post-process before dumping them into a TEXTBOX.
I think I found at least a partial answer... a command called
CShort (Expr AS Variant) getting closer at least... then eventually I'll replace this thread with an exact step-by-step to help out anyone else from going through this!
Thanks in advance!
Jerry