I have used I2C single channel ADC and Temperature sensors on an 08M2 and am interested in expanding the ADC to use 4 channel ADS1015 devices. I cannot find useful info re the channel selection on the TI data sheet. here is an example of portion of picaxe code I have used in the past, adapted from code written many years ago by others in the picaxe community
'###########################################################
' I2C Sensors picaxe 08M2 slave
' 9/4/2012
'
'###########################################################
#picaxe 08m2
setfreq m4
symbol sensor_value = w0
symbol ADC_sensor_1 = w1
symbol lo_byte = b0
symbol hi_byte = b1
symbol I2C_setup = i2cfast_4
'%%%%%%%%%%%% ADC SETUP %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
symbol control_ADC = %10001101 'Cb=%10001101
symbol ADC1 = %10010010 'A1=%10010010
start:
pause 1000
sertxd ("[Initializing I2C]",13,10)
'adc1
i2cslave ADC1,I2C_setup,i2cbyte
writei2c (control_ADC)
pause 20
main:
pause 2000
ReadSensors:
'%%%%%%%%%%%%%%%%%% ADC Sensors %%%%%%%%%%%%%%%%%%%%%%%%%%%
i2cslave ADC1,I2C_setup,i2cbyte
gosub Read_ADC
ADC_sensor_1 = sensor_value
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
gosub Send_Data
goto main
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Read_ADC:
readi2c (hi_byte,lo_byte)
...............................................................................
I am not sure how to transition to get individual channels from a multple input device
Not keen on the Arduino route.
Any help would be appreciated
'###########################################################
' I2C Sensors picaxe 08M2 slave
' 9/4/2012
'
'###########################################################
#picaxe 08m2
setfreq m4
symbol sensor_value = w0
symbol ADC_sensor_1 = w1
symbol lo_byte = b0
symbol hi_byte = b1
symbol I2C_setup = i2cfast_4
'%%%%%%%%%%%% ADC SETUP %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
symbol control_ADC = %10001101 'Cb=%10001101
symbol ADC1 = %10010010 'A1=%10010010
start:
pause 1000
sertxd ("[Initializing I2C]",13,10)
'adc1
i2cslave ADC1,I2C_setup,i2cbyte
writei2c (control_ADC)
pause 20
main:
pause 2000
ReadSensors:
'%%%%%%%%%%%%%%%%%% ADC Sensors %%%%%%%%%%%%%%%%%%%%%%%%%%%
i2cslave ADC1,I2C_setup,i2cbyte
gosub Read_ADC
ADC_sensor_1 = sensor_value
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
gosub Send_Data
goto main
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Read_ADC:
readi2c (hi_byte,lo_byte)
...............................................................................
I am not sure how to transition to get individual channels from a multple input device
Not keen on the Arduino route.
Any help would be appreciated