Python3 for Max1416 Adc

spi
2018-04-14 13:10:52

While trying to connect to a Max1416epe 16-bit Adc using "spidev", I changed the

r = spi.xfer2([1, 8 + adcnum << 4, 0])

adcout = ((r[1] & 3) << 8) + r[2]

for reading a Mcp3008 to

r = spi.xfer2([1, 8 + adcnum << 4, 0])

adcout = r[1] + r[2]

to collect the 16-bits. I have connected a variable resistor to "Ain+_pin 7" & Gnd to "Ain-_pin 8".

Before polling I set "Reset_pin5" to 0 for 1mSec then back to 1. No reading was collected. However in the datasheet:

https://datasheets.maximintegrated.com/en/ds/MAX1415-MAX1416.pdf

I notice that 2 channels for "adcnum" have to be identified to read "Ain+". See Table 8. How can I insert that into the

r = spi.xfer2([1, 8 + adcnum << 4, 0])

line? I have been using "0" for adcnum.